Author Topic: How do I make animations work in game?  (Read 701 times)

I made an animation from PanDans tip tutorial 2.5, I did everything and the animations is done and the model is exported.
But when I run the game, how can i make the trigger move when I shoot?

If you use Milkshape, you need to create and export the animation sequence. Name it something you can remember. In the script there is that long list of command that all end in [1] up to 5 normally. 0 and 1 are when you take out the weapon. I don't know what fire is. You will have to experiment. There is a code you add there that plays the animation. But I don't know it off the top of my head. I'm on an iPod so I can't post the code either... Post that section of an add on that does have animation and I'll show you how it works.

Thanks yau vary munch.

EDIT:

I opened the .cs and this opens, so some help would be appreciated:

Code: [Select]
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.15;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;
stateSequence[1] = "Ready";

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Smoke";
stateTimeoutValue[2]            = 0.14;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = BaraGunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = BaraGunShot1Sound;
stateEjectShell[2]       = true;

stateName[3] = "Smoke";
stateEmitter[3] = BaraGunSmokeEmitter;
stateEmitterTime[3] = 0.05;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3]            = 0.01;
stateTransitionOnTimeout[3]     = "Reload";

stateName[4] = "Reload";
stateSequence[4]                = "Reload";
stateTransitionOnTriggerDown[4]  = "Fire";
stateTransitionOnTriggerUp[4]     = "Ready";
stateSequence[4] = "Ready";
« Last Edit: January 30, 2010, 12:35:02 PM by Barakuda »

Does the switch blade have custom stabbing animation?


Well see where it says:
   stateSequence[1]   = "Ready";

that's an animation. Replace "Ready" with your animation name.
Also where you see the [1], that is when your animation will play. You can change it to anything between 0 to I think 5. Yours says 4. 0 is when you take the weapon out. 1 is after you fire the gun resets. This is the same as 0 but plays every time after you fire. 3 is fire. I'm not sure about the rest or these. You will have to experiment.

I did, but now it doesnt shoot when I try to and the animation doesnt show.

Are you sure you exported the animation correctly? What program do you use?

I use milkshape 3d. I folowed Pandans tutorial but I probably made a mistake so i will do it again.

EDIT: I did it again but it sadly doesnt work. Is there any better animating tutorials?
« Last Edit: February 06, 2010, 11:04:06 AM by Barakuda »

Maybe I could make one...