Author Topic: A few (should be) easy to asnwer questions about weapons  (Read 589 times)

How do I add an emitter?
How would I make it so the emitter starts when the weapon is firing, and stops when the weapon stops firing (Emitter on when left mouse is clicked, and off when released)?
How do I make the weapon play an animation when it is equipped?

Sorry for the stupid questions.
« Last Edit: April 18, 2009, 02:50:13 PM by Snaffle J. Bean »

First question, can you even script? Just askin' Anyway, now to the meat:
I have no idea how animations are controlled, but the other two are controlled by states, wait for me while I get an Example:
Code: [Select]
   // Initial start up state
stateName[0] = "Activate";           <<<<<This is the state when you switch to the weapon
stateTransitionOnTriggerDown[0] = "Fire";  <<<<<< Note that when the "trigger" in most cases this
stateSound[0] = weaponSwitchSound;      is a mouse is down, it switches to the fire state

stateName[1] = "Ready";
stateEmitter[1] = G36CsmokeEmitter;
stateEmitterTime[1] = 1;
stateEmitterNode[1] = "muzzleNode";       <<<< So when you start shooting, it completely
stateTransitionOnTriggerDown[1] = "Fire"        skips over this state and goes to...
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";

stateName[2]                    = "Fire";        << this one, this is the fire state
stateTransitionOnTimeout[2]     = "Smoke";
stateTimeoutValue[2]            = 0.04;
stateFire[2]                    = true; 
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = G36CflashEmitter; <<<< This is how you make an emitter, a state
stateEmitterTime[2] = 0.04;         Emitter, in this case, the "muzzleNode" emits the G36C flash
stateEmitterNode[2] = "muzzleNode";  emitter while this state is commencing, in short, an
stateSound[2] = G36CshotSound;  emitter when the weapon is firing
stateEjectShell[2]        = true;

stateName[3] = "Smoke"; <<<< This is the next state, it does not emit smoke though
stateTimeoutValue[3]            = 0.04;
stateTransitionOnTimeout[3]     = "Reload";

stateName[4] = "Reload"; <<< Then it switches to this state
stateSequence[4]                = "Reload";
stateTransitionOnTriggerUp[4] = "Ready"; << Now this is where when you stop firing, it switches
stateTransitionOnTriggerDown[4] = "Fire";  to the state "ready" where if you look, is where the
stateSequence[4] = "Ready";        state emitter is the smoke emitter, so in short, you can
                                                   control when your weapon emits stuff through states and state emitters.   And that's why it skipped the "ready" state at first.
};
Since it's the only gun that I can remember off hand that has an effect while your shooting it, and when you stop shooting it, I am going to use the G36C by Amade. I will comment in the code above. (Im working on it)
« Last Edit: April 18, 2009, 03:11:33 PM by AGlass0fMilk »

I can't script from scratch, but I've been studying various blockland weapons and I'm starting to learn a few things.

I'm going to be making a chainsaw weapon for one of my friends (he's going to have some chainsaw duel server or something).

I updated my post above, look at it.