View unanswered posts | View active topics It is currently Fri Jan 10, 2025 8:49 am



Reply to topic  [ 12 posts ] 
 Jetpack animation help 
Author Message
User avatar

Joined: Wed Feb 27, 2008 4:04 am
Posts: 30
Reply with quote
Post 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.


Thu Jul 09, 2009 5:24 pm
Profile
User avatar

Joined: Fri Jun 19, 2009 5:57 pm
Posts: 84
Reply with quote
Post 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.


Thu Jul 09, 2009 6:13 pm
Profile
User avatar

Joined: Wed Feb 27, 2008 4:04 am
Posts: 30
Reply with quote
Post 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!


Thu Jul 09, 2009 8:34 pm
Profile
User avatar

Joined: Fri Jun 19, 2009 5:57 pm
Posts: 84
Reply with quote
Post 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.


Thu Jul 09, 2009 9:14 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Jetpack animation help
Too bad that jetpacks aren't MOIDs.


Thu Jul 09, 2009 9:15 pm
Profile
User avatar

Joined: Fri Jun 19, 2009 5:57 pm
Posts: 84
Reply with quote
Post Re: Jetpack animation help
Yeah, CC could use completely going Lua. Supreme Commander is all Lua, down to individual projectiles, and still works well.


Thu Jul 09, 2009 9:17 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Jetpack animation help
Especially wounds. I suspect that they are hidden somewhere inside the actor, though.


Thu Jul 09, 2009 9:35 pm
Profile
User avatar

Joined: Mon Oct 06, 2008 2:04 am
Posts: 1559
Reply with quote
Post 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?


Fri Jul 10, 2009 3:30 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Fri Jul 10, 2009 3:41 am
Profile
User avatar

Joined: Mon Oct 06, 2008 2:04 am
Posts: 1559
Reply with quote
Post 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?


Fri Jul 10, 2009 3:43 am
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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.


Fri Jul 10, 2009 5:01 pm
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Jetpack animation help
Yeah, thruster flash.


Fri Jul 10, 2009 5:03 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 12 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.050s | 14 Queries | GZIP : Off ]