Need help writing a check for a button press

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

billy240clint@hotmail

|*BILLY$CLINT*|
Jan 21, 2006
54
0
0
So it has been a couple of days now and I have not really gotten that far with my code. As of right now I have the Forklift playing and animation when you press the ALTFire it plays the animation of the forklift going up. The when you release the button the animation for the lift to go back down is played. But there is a big problem. When you press the ALT Fire multiple times it will play the up animation no matter what. So I have figured thus far i need to write a check that sees if the button has been pressed and does not allow the player to hit the button again till the whole animation is played. Any ideas would be great. Thanks in advnace

BILLY c.
 

[RP]Capone

New Member
Jul 23, 2004
65
0
0
Well you could create a variable called bFLAimPlayed or something in your vehicle class. Set the default to true, then in your altfire where you play the anim you could check if it's true and play then anim and set it to false. If not return false. Then to reset the variable you could use AnimEnd() to check if that anim has played and set the variable to true. Basically AnimEnd() is called every time an animation has ended, then you can get the channel and check what anim has just ended and do whatever. I use this quite a bit on complex weapons.
 

billy240clint@hotmail

|*BILLY$CLINT*|
Jan 21, 2006
54
0
0
I got it to work

Yeah about 20 minutes after I asked you for your help I figured it out. Heres the code it just took a little thinking about what I wanted to do and then I got it. But thanks for the help, if you see anything that I am doing wrong or that could make my code better PLEASE let me know this is the first unreal project that I have done that is to this caliber. I would now like to make the forklift move object but do you know how i would go about doing that or better yet could you point me in the direction where I cold read about the code. Well thanks for your help and any future help.

BILLY c.

Code:
var () bool isLiftDown;

function VehicleFire(bool bWasAltFire)
{
   if (!isAnimating(0))
   {
       if (bWasAltFire && isLiftDown )
       {
          PlayAnim('Up');
          isLiftDown = false;
       }
       else if (!bWasAltFire && !isLiftDown)
       {
          PlayAnim('Down');
          isLiftDown = true;
       }
   }
}
 
Last edited: