General weapon fire code question
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
General weapon fire code question
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.
So long, and thanks for all the fish
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: General weapon fire code question
I did something like that in my new translocator (for ease of control), and it's something like this:
For altfire is the same, but instead use AltFiring and ClientAltFiring states and the bAltFire pawn flag.
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();
}
}
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: General weapon fire code question
Ah...ok I see. You force the animation to go back to resting...Nice! Just what I needed, thanks!!
So long, and thanks for all the fish