Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
Animations for non-automatic weapons?
Okay, so I have some semi-automatic weapons that have a seven-frame animation when firing. Problem is, no matter what I set the animation speed or mode to, I can't seem to get it to animate through the full sequence. It just goes from 000-idle to 001-first frame to back to 000-idle when fired.
Is there anything I can do, or is this a problem with the engine itself?
Tue Jun 05, 2012 8:51 pm
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
Re: Animations for non-automatic weapons?
Weapons are hardcoded to use only 2 frames. The first when not firing and the second for firing.
A workaround for this is to give it an attachable and animate it via lua.
Tue Jun 05, 2012 10:12 pm
Arcalane
Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
Re: Animations for non-automatic weapons?
Annoying. Do you have any simple examples of that to hand? I see the SAW RULAS has an animated attachable, but I don't see how the script triggers the animation.
Tue Jun 05, 2012 10:22 pm
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
Re: Animations for non-automatic weapons?
The animation on the RULAS was just an ini attachable that was always animated. No lua involved with it.
If you want something like where the weapon is animated when firing or you want to specifically change it to certain frames then you have to use lua. But if it's something that's constantly animated no matter, just use ini.
Wed Jun 06, 2012 12:09 am
Arcalane
Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
Re: Animations for non-automatic weapons?
The idea is to have part of the plasma weapons 'heat up' when fired, then fade back to normal. I have the attachables sprited, attached, and ready to go, just need a script to make them animate properly when the weapon fires.
If you just want it to run through the frames shouldn't it be something as simple as attaching a script like:
Code:
function Create(self) self.FrameTimer = Timer(); self.FrameInterval = 250; self.FrameTimer:Reset(); self.Frame = 0; end function Update(self) if self.FrameTimer:IsPastSimMS(self.FrameInterval) and self.Frame < 8 then self.Frame = self.Frame + 1; end end function Destroy(self) end
Keeping in mind that the lifetime needs to be set appropriately (in ini or lua).
If you want it to go up then go back down through the frames then this should do that:
Code:
function Create(self) self.FrameTimer = Timer(); self.FrameInterval = 250; self.FrameTimer:Reset(); self.Frame = 0; self.FrameDirection = 0; end function Update(self) if self.Frame == 0 then self.FrameDirection = 0; elseif self.Frame == 7 then self.FrameDirection = 1; end if self.FrameTimer:IsPastSimMS(self.FrameInterval) then if self.FrameDirection == 0 and self.Frame < 8 then self.Frame = self.Frame + 1; elseif self.FrameDirection == 1 and self.Frame > 0 then self.Frame = self.Frame - 1; end self.FrameTimer:Reset() end end function Destroy(self) end
Keep in mind none of this has been tested or anything silly like that so I can't guarantee it'll work.
Wed Jun 06, 2012 4:17 am
Arcalane
Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
Re: Animations for non-automatic weapons?
Getting it to animate 'normally' is as simple as setting the desired AnimDuration and AnimMode on the attachable itself. That's not the problem, because I don't want the attachable to animate normally. The problem is that the animation is meant to cycle once, when the gun fires.
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