Data Realms Fan Forums
http://forums.datarealms.com/

Console spamming: Magazine frame changing script.
http://forums.datarealms.com/viewtopic.php?f=73&t=25501
Page 1 of 1

Author:  Kettenkrad [ Tue Sep 13, 2011 10:15 am ]
Post subject:  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:

Author:  ramonimbao [ Tue Sep 13, 2011 12:00 pm ]
Post subject:  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

Author:  Grif [ Thu Sep 15, 2011 12:43 am ]
Post subject:  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.

Author:  Azukki [ Thu Sep 15, 2011 8:34 am ]
Post subject:  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

Author:  Kettenkrad [ Thu Sep 15, 2011 9:20 am ]
Post subject:  Re: Console spamming: Magazine frame changing script.

Thanks guys, got it working eventually.
I ended up using your script, Azukki, thanks.
Image

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/