Data Realms Fan Forums
http://45.55.195.193/

Jetpack animation help
http://45.55.195.193/viewtopic.php?f=1&t=15779
Page 1 of 1

Author:  Invalidator [ Thu Jul 09, 2009 5:24 pm ]
Post subject:  Jetpack animation help

Hey, I want to make a jetpack that has a sprite animation, but alas I have a problem. When not emitting (the actor is not flying) the jetpack is supposed to fold up. Then, when you start flying about, the jetpack animates (unfolds) and then waits in its unfolded state and emits particles. I've read through the forums and found that the SpriteAnimMode is the property I want, and it needs either a 0 or 1 value (different threads said different values for "One loop then stop"). Anyways, the point is that it doesn't work. It will loop, but won't pause after one cycle, so the jetpack keeps unfolding and folding up. This is not very cool looking when your backpack keeps flapping like a broken wing. (Although from this I did make a "pair of wings" jetpack that flaps when you use it :D).

Anyways, I just wanted to know if the Jetpack AEmitters just don't work with SpriteAnimMode, or if the number I am supposed to be using is different, or if there is another property that is disabling it or something.

Thanks.

Author:  Sean Mirrsen [ Thu Jul 09, 2009 6:13 pm ]
Post subject:  Re: Jetpack animation help

Beside Lua, there's no way to limit the unfold animation to specific loops on specific triggers. (and even then it's tricky)

You could try to do it simpler, and just have a flash that includes the unfolded jetpack. The Darkstorm mod does it that way, IIRC.

Author:  Invalidator [ Thu Jul 09, 2009 8:34 pm ]
Post subject:  Re: Jetpack animation help

Eh, that sounds really hacky. I can just leave it in its unfolded state for now.

Thank you for the help, though!

Author:  Sean Mirrsen [ Thu Jul 09, 2009 9:14 pm ]
Post subject:  Re: Jetpack animation help

Well, you can do it differently, too. Through Lua, create a virtual attachment for your actor, and have it animate when the actor jumps. Virtual attachments are tricky beasts though, and have their limits.

The code to do animating would be something like
Code:
if self.GetController():IsState(Controller.HOLD_UP) then //the actor is jumping
   if self.JetAttach.Frame == 0 and self.JetAttach.SpriteAnimMode == 0 then //the sprite is not animating and shows up folded
      self.JetAttach.Frame = 1; //put it into next frame
      self.JetAttach.SpriteAnimMode = 1; //start animating
   end
   if self.JetAttach.Frame == 5 and self.JetAttach.SpriteAnimMode == 1 then //the sprite is animating and unfolded, and we're still flying
      self.JetAttach.SpriteAnimMode = 0; //stop animating
   end
end

if self.JetAttach.Frame == 5 and self.JetAttach.SpriteAnimMode == 0 then //the sprite is unfolded and we're not flying
   self.JetAttach.SpriteAnimMode = 1; //let it animate till it closes
end

if self.JetAttach.Frame = 0 and self.JetAttach.SpriteAnimMode = 1 then //the sprite is folded and animating
   self.JetAttach.SpriteAnimMode = 0; //stop animating, this is why we set the frame to 1 at start of jump
end

This presumes a MOSRotating as a virtual attachment, with a sprite anim of about 10 frames, the first 5 of which are it unfolding, and the next 5 folding. The virtual attachment itself is just a particle that gets its position, rotation, and velocity set to that of your actor each frame.

It's a bit hackish, because you have to do stuff like check for whether the attachment exists, destroy it when the actor is killed, and even do stuff like handling its existence when the actor is loaded somewhere. But it can be done like this, too.

Author:  mail2345 [ Thu Jul 09, 2009 9:15 pm ]
Post subject:  Re: Jetpack animation help

Too bad that jetpacks aren't MOIDs.

Author:  Sean Mirrsen [ Thu Jul 09, 2009 9:17 pm ]
Post subject:  Re: Jetpack animation help

Yeah, CC could use completely going Lua. Supreme Commander is all Lua, down to individual projectiles, and still works well.

Author:  mail2345 [ Thu Jul 09, 2009 9:35 pm ]
Post subject:  Re: Jetpack animation help

Especially wounds. I suspect that they are hidden somewhere inside the actor, though.

Author:  LowestFormOfWit [ Fri Jul 10, 2009 3:30 am ]
Post subject:  Re: Jetpack animation help

This is the same problem I'm having with the Behemoth's integrated Fist-flamethrower.

Myself wrote:
There was a small discussion in IRC, and it eventually led to an integrated flamethrower request.
This is the weapon sprite I've come up with, integrated, of course.
Image

I have one problem though. I need the first frame to obviously be when the gun isn't firing, and the last frame of the animation to stick after the animation has been played once when it IS firing. Right now, SpriteAnimMode = 4 makes it constantly play from start to finish, constantly "deploying" the flamethrower.

So basically:
Non firing = Frame000
Firing = Animation from Frame000 to Frame004
After Animation is finished yet Behemoth is still firing = Frame004

I assume Sparkle Magic will be needed for this?

Author:  Grif [ Fri Jul 10, 2009 3:41 am ]
Post subject:  Re: Jetpack animation help

Step 1: Attach emitter to gun.
Step 2: Have emitter emit a particle that determines the parent and checks whether the parent is firing.
Step 3: Cycle through attachables until you get the right presetname and MOID.
Step 4: If parent is firing, iterate through animation frames on the gun already determined.
Step 5: If parent is not firing and frame is not 000 then cycle down frames to 000.

Actually nevermind. Since it's for a custom actor, just on create try to find the gun that matches your MOID, then do steps 4 and 5.

Author:  LowestFormOfWit [ Fri Jul 10, 2009 3:43 am ]
Post subject:  Re: Jetpack animation help

Grif wrote:
Step 1: Attach emitter to gun.
Step 2: Have emitter emit a particle that determines the parent and checks whether the parent is firing.
Step 3: Cycle through attachables until you get the right presetname and MOID.
Step 4: If parent is firing, iterate through animation frames on the gun already determined.
Step 5: If parent is not firing and frame is not 000 then cycle down frames to 000.

Actually nevermind. Since it's for a custom actor, just on create try to find the gun that matches your MOID, then do steps 4 and 5.


What's the most efficient way to check and find the gun?

Author:  numgun [ Fri Jul 10, 2009 5:01 pm ]
Post subject:  Re: Jetpack animation help

check out DarkStorm, Darlos made the jetpacks sort of have an active sprite when in use.
could be that it was part of the thruster flash, dunno. check it out.

Author:  411570N3 [ Fri Jul 10, 2009 5:03 pm ]
Post subject:  Re: Jetpack animation help

Yeah, thruster flash.

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