Joined: Mon Oct 25, 2010 5:51 am Posts: 1198 Location: Sydney
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:
The script:
Code:
function Create(self) self.Magazine = ToMagazine(self.Magazine) self.MagazineFrame = 1 end
function Update(self) if ToMagazine(self.Magazine) ~= false and ToMagazine(self.Magazine).RoundCount > 0 then self.MagazineFrame = ((self.Magazine.RoundCount / 25) + 1); if self.MagazineFrame > 11 then self.MagazineFrame = 11 end ToMOSprite(self.Magazine).Frame = self.MagazineFrame end end
Tue Sep 13, 2011 10:15 am
ramonimbao
Joined: Sat Jan 17, 2009 8:53 am Posts: 79 Location: Philippines
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
Thu Sep 15, 2011 8:34 am
Kettenkrad
Joined: Mon Oct 25, 2010 5:51 am Posts: 1198 Location: Sydney
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