Author Topic: Weapon States: Difference between when you click and when it actually shoots  (Read 786 times)

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

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

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Smoke";
stateTimeoutValue[2]            = 0.3;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitterTime[2] = 0.35;
//stateSound[2] = LegibiterSwingSound;
stateEjectShell[2]       = true;

stateName[3] = "Smoke";
stateEmitterTime[3] = 0.65;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3]            = 0.6;
stateTransitionOnTimeout[3]     = "Reload";

stateName[4] = "Reload";
stateSequence[4]                = "Reload";
stateTransitionOnTriggerUp[4]     = "Ready";
stateSequence[4] = "Ready";
I don't get it. States are confusing. Where do I change the delay between when I click and when it shoots. Currently when I activate it instantly fires.

By activate, you mean click and try to swing the sword, right?

By activate, you mean click and try to swing the sword, right?
Yes.

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


This is the main state that you are in when it's idle.
You've set that it should transition to another state when you press down the trigger and that specific state is "Fire".

You'll want to create a new state with a timeout value that transitions to the "Fire" state on timeout and use that as the transition for pressing down the trigger in the "Ready" state instead.

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


This is the main state that you are in when it's idle.
You've set that it should transition to another state when you press down the trigger and that specific state is "Fire".

You'll want to create a new state with a timeout value that transitions to the "Fire" state on timeout and use that as the transition for pressing down the trigger in the "Ready" state instead.
I wasnt getting any of that.  :(

I wasnt getting any of that.  :(

Create a new state named something such as "WaitForFire".
Set it's timeout value to something.
Set it to transition to the "Fire" state on timeout.
In the "Ready" state, replace the transition when the trigger is pressed to the "WaitForeFire" state.

Code: [Select]
   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.1;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTimeoutValue[1]             = 0.3;
stateTransitionOnTriggerDown[1]  = "WaitForFire";
stateAllowImageChange[1]         = true;
stateSequence[1] = "Ready";

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Smoke";
stateTimeoutValue[2]            = 0.3;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitterTime[2] = 0.35;
//stateSound[2] = LegibiterSwingSound;
stateEjectShell[2]       = true;

stateName[3] = "Smoke";
stateEmitterTime[3] = 0.65;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3]            = 0.6;
stateTransitionOnTimeout[3]     = "Reload";

stateName[4] = "Reload";
stateSequence[4]                = "Reload";
stateTransitionOnTriggerUp[4]     = "Ready";
stateSequence[4] = "Ready";

stateName[5] = "WaitForFire";
stateTimeoutValue[5]             = 0.4;
stateTransitionOnTimeout[5]       = "Fire";
};

Still instant, no matter what I set it to.