machine weps

Author Topic: machine weps  (Read 1598 times)

i just started scripting and i made one script so far but ive always wondered how to make something do this.ive looked in some scripts for how this works but i cant find out how to make something shoot continously like a machine gun.

i hope this sint such a nooby question but if soemone could help me out that'd be great.  :D

I think you're better off not knowing if it means we wont be plagued by more machine guns :/

Anyways look at the state system in the gun's .cs file.

well i havent really decided weather im making a machine gun (most likely not) yet but i just wanted to have the knowlage to do so when the time comes. thanks anyways tho...

*im also kinda to scripting so ill try to find out how by looking at state system but i might need a more specific answer :/*
« Last Edit: June 28, 2008, 11:11:18 PM by nano »

Okay.

The state system is this part, btw:
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";

Basically what you want to modify is the last part, the "Reload".

See, it goes back to ready once you lift up the trigger, and then ready goes to fire once you put down the trigger. You need to make it keep going to fire until you lift up the trigger.

Try looking at the states part in both the Gun file (what Rkynick posted) and the Bow - the gun has a "muzzle flash" effect and the bow fires continuously while you hold Fire. What you may want to do is reduce the timeout for the reload/delay to make it fire faster.

thanks guys. cookies for you :D  :cookie: :cookie: :cookie:

Nano you noob, You said you had no help on that destructo machine gun!

Quote
Code: [Select]
stateName[4] = "Reload";
stateSequence[4]                = "Reload";
stateTransitionOnTriggerUp[4]     = "Ready";
stateSequence[4] = "Ready";
Hmm... i wonder what would happen if you changed those all to Fire...
« Last Edit: July 06, 2008, 01:29:08 AM by Slicksilver555 »

Then the gun wouldn't fire at all as that state would end up replacing the normal fire state (even if you left it as state 3, this one is created after) and would get stuck in that mode, appearing to fire but nothing coming out of the barrel.

Oh. i thought it would do some stuff like fire 2 bullets and then break.