| Blockland Forums > Modification Help |
| Firing a weapon once every second (States) |
| (1/1) |
| Demian:
Okay I'm getting incredibly pissed off. This was supposed to be a 2 minute edit. I've been trying to get this piece of stuff to work for a whole day now. I want my sword to fire once per second when I hold down the fire key. In other words I just copied the sword states and tried editing the timeout values, make new states and create the states myself from scratch. Nothing. Works. I can either fire it like the sword or click and make it fire automatically for X seconds. Why is this so hard?! D= This is incredibly annoying. --- Code: --- stateName[0] = "Activate"; stateTimeoutValue[0] = 0.5; stateTransitionOnTimeout[0] = "Ready"; stateSound[0] = swordDrawSound; stateName[1] = "Ready"; stateTransitionOnTriggerDown[1] = "PreFire"; stateAllowImageChange[1] = true; stateName[2] = "PreFire"; stateScript[2] = "onPreFire"; stateAllowImageChange[2] = false; stateTimeoutValue[2] = 0.1; stateTransitionOnTimeout[2] = "Fire"; stateName[3] = "Fire"; stateTransitionOnTimeout[3] = "CheckFire"; stateTimeoutValue[3] = 0.2; stateFire[3] = true; stateAllowImageChange[3] = false; stateSequence[3] = "Fire"; stateScript[3] = "onFire"; stateWaitForTimeout[3] = true; stateName[4] = "CheckFire"; stateTransitionOnTriggerUp[4] = "StopFire"; stateTransitionOnTriggerDown[4] = "Fire"; stateName[5] = "StopFire"; stateTransitionOnTimeout[5] = "Ready"; stateTimeoutValue[5] = 0.2; stateAllowImageChange[5] = false; stateWaitForTimeout[5] = true; stateSequence[5] = "StopFire"; stateScript[5] = "onStopFire"; --- End code --- Sword states. |
| Amade:
Change the timeout on state 5 to 0.8. |
| Demian:
Yes, that would add a 1 second delay after I have stopped firing. What I want to do is hold down the button, fire, wait 1 second, fire, wait 1 second and so on. |
| Amade:
oops, try this --- Code: --- stateName[0] = "Activate"; stateTimeoutValue[0] = 0.5; stateTransitionOnTimeout[0] = "Ready"; stateSound[0] = swordDrawSound; stateName[1] = "Ready"; stateTransitionOnTriggerDown[1] = "PreFire"; stateAllowImageChange[1] = true; stateName[2] = "PreFire"; stateScript[2] = "onPreFire"; stateAllowImageChange[2] = false; stateTimeoutValue[2] = 0.1; stateTransitionOnTimeout[2] = "Fire"; stateName[3] = "Fire"; stateTransitionOnTimeout[3] = "StopFire"; stateTimeoutValue[3] = 0.2; stateFire[3] = true; stateAllowImageChange[3] = false; stateSequence[3] = "Fire"; stateScript[3] = "onFire"; stateWaitForTimeout[3] = true; stateName[5] = "StopFire"; stateTransitionOnTimeout[5] = "Ready"; stateTimeoutValue[5] = 0.7; stateAllowImageChange[5] = false; stateWaitForTimeout[5] = true; stateSequence[5] = "StopFire"; stateScript[5] = "onStopFire"; --- End code --- |
| Demian:
Thanks, works now. |
| Navigation |
| Message Index |