How to make "On hold button" in widget blueprint?

Hello, in the widget blueprint I have - and + buttons which change value,but its too slow, how to make fast change on hold?

I made a rapid fire module for shooting projectiles. I think the same concept could apply here.

On the left where it says InputAction Shoot, replace “pressed” with your "On clicked"event, and replace “released” with an “On released” event from the button you’re using

A nifty delayed repeater can be achieved like so:

  • Time - the rate of execution, here 10 times per second
  • Initial Start Delay - how long to wait before execution starts

Releasing the button resets the whole thing.

2 Likes

Oh I found a mistake in my attempt :slight_smile: But I dont dont have Initial Start Delay, devs add it after 4.22?

Hmmm, now I need to think how to make hold detection timer :slight_smile: In you blueprint you need to add branch with first shoot check, because with bigger delay you get charging gun.

But wait, did this delay work? If you set it to 1, gun will wait 1 second and then start rapid fire? Its not looks like pause between shoots.

I believe it’s an older feature but I may be wrong. There’s a tiny arrow at the bottom of some nodes, expanding the panel shows additional settings. Is it not available in 4.22? It feels like I’ve been using it for years.

Alternatively, consider placing a Delay node between onPressed and the Timer instead.

Looks like its works fine, but is it right? :slight_smile: No tiny arrow as you see :slight_smile:

Looks fine at a glance. One note - you do not need the Set nodes here, the ++ sets values by ref. (note the diamond shaped icon). Atm you’re setting things twice, twice.

The end result is the same but with less overall clarity, if that matters to you.

Good luck with the rest!

Thanks for help, good luck you too :slight_smile:

yea, that delay node was for time between shots. If you wanted to add a “charge up” time, then you could add another delay between “Pressed” and “Rapid Fire”, and that duration would be the charge up time.

Its looks like if I set delay to 1 and then hold button for 0.9 sec - I dont make a shot, but if I press button again after 0,09 sec, I make a shot at beginning. Its no a retriggerable delay. And “Set Timer by Event” here really better.

Oh wait, if just click button - then the timer will start working on its own.

Thats I how did it without Initial Start Delay :slight_smile: