Author Topic: (Solved) Making a multi-charge level gun?  (Read 505 times)

Basically what I am trying to acheive is that if you hold down on the mouse button for one second before releasing, it will fire a charged shot with shooting several projectiles at once, where as a not charged shot will only fire one projectile. For the most part I have gotten it to work, but the problem is, if you want to fire a single projectile, you still need to wait the 1 second after you click for it to shoot. Is there any way to fix this?

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

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

stateName[2] = "Charge";
statetransitionOnTimeOut[2] = "ChargeFull";
stateTransitiononTriggerup[2]   = "Fire";
stateTimeoutValue[2] = 1;


stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "Reload";
stateTimeoutValue[3]            = 0.74;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
stateEmitter[3] = WBowFlashEmitter;
stateEmitterTime[3] = 0.05;
stateEmitterNode[3] = "muzzleNode";
stateSound[3] = WBowShotSound;

stateName[4]                    = "ChargeFull";
stateTransitionOnTimeout[4]     = "Reload";
stateTimeoutValue[4]            = 0.74;
stateFire[4]                    = true;
stateAllowImageChange[4]        = false;
stateSequence[4]                = "Fire";
stateScript[4]                  = "onChargeFire";
stateWaitForTimeout[4] = true;
stateEmitter[4] = WBowFlashEmitter;
stateEmitterTime[4] = 0.05;
stateEmitterNode[4] = "muzzleNode";
stateSound[4] = WBowShotSound;

stateName[5] = "Reload";
stateSequence[5]                = "Reload";
stateTransitionOnTriggerUp[5]     = "Ready";
stateSequence[5] = "Ready";
« Last Edit: July 29, 2009, 07:30:01 PM by ladios »

Adding
Code: [Select]
Statewaitfortimeout = "false";To the state[2] might work. I am testing it now.


[edit] It worked. The spear's code helped me here.
« Last Edit: July 29, 2009, 07:29:51 PM by ladios »