Action on Button Held Down?

Hi, I’m looking for a way to have a player action continuing active while a button is held down in blueprint. Specifically, I’m using the Launch Character node. So I want Launch Character to be firing and increasing the character velocity as long as the assigned button is held down, and then stop as soon at it is let go. Any advice on how to do this?

  1. Create a boolean variable, name it properly like “Is X Button Down”, where X is your button name.
  2. Drag the key event, for examle F, to your blueprint
  3. Link Pressed to a “Set X Button Down” node and check the value on it.
  4. Link Released to another “Set X Button Down” node and leave the value unchecked
  5. Create a Event Tick node
  6. Connect it to a branch node, the Condition is a “Get X Button Down” node
  7. The True output leads to your Launch Character event stuff
  8. Your done :slight_smile:

Remember to use Delta Seconds to compensate for CPU speeds

1 Like

This works like a charm- thank you very much! But can you explain what you mean by using Delta Seconds? I see the pin for it on the tick node but am not sure what to actually do with it. Appreciate it!

deltaSeconds is how many seconds has passed between frames. usually you multiply it by a velocity, to make that velocity feel the same at different frame rates.

Exactly! When you multiply a per-frame value-change with deltaSeconds, you get a per-second behaviour. That means if you add 1.0 to your velocity each frame and multiply with deltaSeconds, you add 1.0 per second.

As an alternative if you don’t want a bunch of things tied to Event Tick:

I’ve got a five second long timeline that will perform the held action only on the execution of Finished, which only executes if the button stays pressed.

how did you made it without the event tick? (the bandage node)
i am new to BP but and its look great

Rather than just answering, let me help you understand. Why do you think you need an event tick?

I would suggest using Physics Forces Instead of Launch in your case (Launch is usually a thing you fire once and not consistently) that you solve with a bool and Branch and hook it into Tick. Alternativly you can Change your Movement Component to Flying Mode and use the Add Movement Input to Controll the Direction.

You can hook it up to a Input Axis Event thats Bound to the same Key as your Action Event. Thats more or less it =)

Example https://i.imgur.com/zlOpLAQ.png

But just in case you really want to use Launch in Intervalls use Timers (the above example with the Timeline is a missuse of a Timeline, sorry Dieinthedark93, no offense) Example: https://i.imgur.com/PvvIiCi.png

Good Luck and have Fun

i dont need event tick. i try to build a alter that the player need to press E to make a progress (like dead by daylight generator).