Page 1 of 1

General weapon fire code question

Posted: Sun Apr 29, 2012 1:10 pm
by JackGriffin
I need to limit weapon firing to one shot per keypress and not allow multiple firing if the button is held down. This needs to be done across multiple weapons but I don't immediately see the code for it in the default weapons or the mods I use as reference. Likely I'm looking at it but I don't realize I'm seeing it so could someone point it out to me on how to limit the fire call to once? Thanks guys.

Re: General weapon fire code question

Posted: Sun Apr 29, 2012 2:17 pm
by Feralidragon
I did something like that in my new translocator (for ease of control), and it's something like this:

Code: Select all

state NormalFire
{
    function AnimEnd()
    {
		if (Pawn(Owner) != None && Pawn(Owner).bFire != 0)
			TweenAnim('Still', 0.1);
		else
			Super.AnimEnd();
    }
}

state ClientFiring
{
    simulated function AnimEnd()
    {
		if (Pawn(Owner) != None && Pawn(Owner).bFire != 0)
			TweenAnim('Still', 0.1);
		else
			Super.AnimEnd();
    }
}
For altfire is the same, but instead use AltFiring and ClientAltFiring states and the bAltFire pawn flag.

Re: General weapon fire code question

Posted: Sun Apr 29, 2012 2:27 pm
by JackGriffin
Ah...ok I see. You force the animation to go back to resting...Nice! Just what I needed, thanks!!