Dodge/Sprint Button

I’m trying to make a button that will dodge if pressed and released before a certain time, and sprint if held for longer than that certain time. Right now that time is 2 seconds, but it will probably end up being something like .75.

Here is what I have so far:

I don’t understand quite how timers work. I’m not sure I should be using event tick. I tried using delay, but that didn’t work because it still fired even when I dodged. I tried using a Timer but couldn’t get that to work either. With this setup, I can’t enter a sprint. Basically, I need the button to start sprint if its held for longer than X, and dodge if held for less than X. I imagine this would be very similar to the code for double tap dodging in unreal tournament. The rest of the code works fine.

Any help is appreciated.

Once this is ironed out, i’m planning on making the sprint button activate a jetpack if it is pressed in the air. Right now, if I dodge again while still in the air after dodging, I shoot off at 1000 mph :slight_smile:

Event Tick is called every frame so you are essentially you’re setting Sprint + 1 every couple milliseconds.

Use a Set Timer Delagate node. I’m not in front of my editor so I can’t show you right this second but basically when the timer goes off it fires a custom event of your choosing. From there you can decide what to do.

Nice!

Now it works just like intended.

Thanks!