Game Development Community

Weapon transition problem

by Jesse P · in Torque Game Engine · 07/29/2008 (5:56 pm) · 1 replies

I am using an RPG and my problem is that although when I run out of ammo it shows the correct image without a rocket but then when I change to another weapon and then switch back it displays the image with a loaded rocket. Although it does correctly make the EmptyShot sound and not fire when I press the fire button.
I strongly suspect it is a transition problem but have been banging my head on the desk all day over it. Perhaps someone can shed some light on what may be wrong. Here is my transition code that I have right now:

// Initial start up state
stateName[0] = "Preactivate";
stateTransitionOnLoaded[0] = "Activate";
stateTransitionOnNoAmmo[0] = "NoAmmo";

// Activating the gun. Called when the weapon is first
// mounted and there is ammo.
stateName[1] = "Activate";
stateTimeoutValue[1] = 0.5;
stateTransitionOnTimeout[1] = "Carry";
stateScript[1] = "onLoad";
stateSequence[1] = "Sequence_Carry";

// Ready to fire, just waiting for the trigger
stateName[2] = "Carry";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "SingleShot";


// Fire the weapon. Calls the fire script which does
// the actual work.
stateName[3] = "SingleShot";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.2;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Sequence_Fire";
stateScript[3] = "onFire";
stateSound[3] = rpg7FireSound;

// Play the relead animation, and transition into
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Carry";
stateTimeoutValue[4] = 0.8;
stateAllowImageChange[4] = false;
stateSequence[4] = "Sequence_Reload";
stateEjectShell[4] = true;
stateSound[4] = rpg7ReloadSound;

// No ammo in the weapon, just idle until something
// shows up. Play the dry fire sound if the trigger is
// pulled.
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmoCarry";
stateTransitionOnTriggerDown[5] = "EmptyShot";

// No ammo dry fire
stateName[6] = "EmptyShot";
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
stateSound[6] = rpg7FireEmptySound;


Thanks in advance,

-Jesse

#1
07/29/2008 (7:52 pm)
Woah, I just realized that when in 3rd person after firing the rocket shows up behind the player head indicating that it is simply at the end of the firing animation. That makes things even more complicated....hmm