I’m using ‘Get Input Key Time Down’ (on the player controller) so the player needs to hold a key for a certain amount of time before an action triggers.
However this node takes actual keys and not ‘key events’, meaning I need some way to dynamically look up the key binding for that event and plug it into this node.
Is this even possible from Blueprints? Looking elsewhere in the forums it seems C++ is needed for reading/writing key bindings, correct?
I don’t know about read keybinding in blueprint, but trigger an event if a key press/release event is held for certain time, you can use SetTimerDelegate on press, set a bool when release, and on the event triggered, check if bool is true before proceed.
In fact, I would suggest you stick to the binded event to avoid future problem, as people usually get ****** when they find out they can’t remap key bindings.
You might find it easier to just manually reconstruct this behavior with timelines; this is what I do. Have pressing any relevant keys set and variable and have releasing unset it. When you want a window for a timed action (i.e. still holding dash after the player has landed, still holding jump after 3 seconds, whatever), you fire a timeline of a given length, and have its “finished” pin run to a branch that checks if the relevant bool is true or false. If it’s true, then the key has been held long enough. If you need the hold to be of a fixed length (i.e the player must hold attack for 3 seconds, if he presses and releases and presses again it doesn’t count) you just have the release command stop the Timeline early.
You could probably do something similar with delays or timers as well.
Yeah timelines seem ideal. Send the “pressed” to “start” and then send “released” to “stop” and draw your final value from the “finished” exit on the timeline.
Since discovering timelines I have been so happy they can achieve so much. Only thing I wish they did was have non-symmetrical speeds, so it went backwards faster than forwards but oh well
Absolutely agree that preventing keys from being remapped is not an option at all, just that I wanted to achieve this entirely using Blueprints.
Thanks, I never realized timelines could be used in such ways! Think I’ll end up using this approach to keep the solution entirely within Blueprints.
However, “Get Input Key Time Down” seems tailor made to this purpose and is extremely simple to setup and use so it’s a bit disappointing that it is rendered futile by operating on explicit key strokes instead of key events.