Author Topic: how to make a full auto weapon  (Read 1684 times)

just like the title

thx :cookie: :cookie:

Like so:

Ok so first you're going to want to open up the weapon's .cs you want,
If you haven't opened one before, use Note Pad to edit it,
I'm going to use the gun as an example,
In the script, look at the bottom, you will see:
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] = gunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = gunShot1Sound;
stateEjectShell[2]       = true;

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

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

};

Now, where it says "Reload", change them to "Ready" (easy way: Ctrl H, type Reload, and in the replace with box put Ready, then hit replace all),
You're gonna see
Code: [Select]
stateTimeoutValue[#]            = #;3 times, replace the number after the = with 0.5 on all three for now, save it and test, it should be auto now.

oh~thank you very much!!!!!!!!!!!!
it's work!!! :cookie: :cookie:

Is there any way to change its rate of fire?

Try changing the number on this line

Code: [Select]
stateTimeoutValue[3]            = 0.01;
Make it higher for a slower rate of fire, or smaller for a faster rate of fire.