View unanswered posts | View active topics It is currently Sat Sep 21, 2019 4:05 am



Reply to topic  [ 5 posts ] 
 Console spamming: Magazine frame changing script. 
Author Message
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1197
Location: Sydney
Reply with quote
Post Console spamming: Magazine frame changing script.
So, I finally made a script largely by myself, and, after an hour or so of inverting frame numbers and calculations, it works almost perfectly!
It changes the frame of a belt of ammo, seemingly shortening it as it is fed into the gun.

The only problem is that, upon reload, it spams the console with this:

Image

The script:


Tue Sep 13, 2011 10:15 am
Profile
User avatar

Joined: Sat Jan 17, 2009 8:53 am
Posts: 79
Location: Philippines
Reply with quote
Post Re: Console spamming: Magazine frame changing script.
In your Update section, you still use ToMagazine(self.Magazine) when you've already defined self.Magazine as ToMagazine(self.Magazine).

ToMagazine-ception. :0


Tue Sep 13, 2011 12:00 pm
Profile YIM WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Console spamming: Magazine frame changing script.
that's not the problem though

what's most likely causing this is the fact that you're trying to change the frame of a magazine while it doesn't exist

I'd suggest, if you can swing it, just make the magazine Discardable = 0 in .ini.


Thu Sep 15, 2011 12:43 am
Profile
User avatar

Joined: Sat Nov 03, 2007 9:44 pm
Posts: 1916
Location: Flint Hills
Reply with quote
Post Re: Console spamming: Magazine frame changing script.
The magazine still won't exist, being non-discardable. It won't drop to the ground, but it will disappear until reloading is done.

Anyways, you're making this way more complicated than it needs to be. You don't need the ToMOSprites and all that. Here's the magazine frame changing portion of one of my scripts, which is working perfectly. Just put this in the update function and replace the nines with the number of frames your mag has. If your frames are in order from empty to full, just take out the "9 -" bit.
Code:
      if self.Magazine then
         self.Magazine.Frame = 9 - math.ceil((self.Magazine.RoundCount/self.Magazine.Capacity) * 9)
      end


Image


Thu Sep 15, 2011 8:34 am
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1197
Location: Sydney
Reply with quote
Post Re: Console spamming: Magazine frame changing script.
Thanks guys, got it working eventually.
I ended up using your script, Azukki, thanks.
Image


Thu Sep 15, 2011 9:20 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.020s | 15 Queries | GZIP : Off ]