How should I implement blueprints so they will register double key and long key presses?

Hello everyone,

so in the past few days I tried to figure out if there is a way to register double key presses and long key presses within Blueprint. I found something here, but it was about C++ code, so not really an option for me since I have barely any experience with C++.

I have a working approach, but I had to change the input method from the axis mapping to action mapping and currently it uses a macro to switch a pressed-variable and a while-loop with a very short delay (0.002). It works, but I think it’s not be efficient enough. Also I still don’t have an idea on how to measure the long press.

The double key press would be useful for dash movement or similar, so nothing too special. But the long key press is what should be able to provide a value that can be used as multiplier for a charged jump for example.

I would be happy to hear some suggestions/ideas ^^

Greetings,
Dakraid


Screenshots:

Double key press:

Movement input:

Howdy!

Not sure if this gives you any leads, but here is how I was measuring time for my long press charge jump:

Hope this helps!

-W

Thank you Wes! Your solution helped a lot! Since I now know how it works, I can go ahead and implement things that I wanted like directional long jumping and some other stuff.

I hope I don’t ask too much, but what do you think about the input method I used, is it ok to use it like that (firing the add movement every 0.001 second seems a bit) or should I go ahead and search for another solution?

There’s so many different ways to do things, I’m honestly learning more and more every day! I will have to give your method a try and see how its going.

Here’s a working dash solution I made if you want:

http://puu.sh/8o9Ss.jpg

As you can see I used the Tick event to update the elpased time between key presses here.