Download

How do I use the same input for 2 actions in the same script?

Hi, in the game I’m making, you are able to interact with objects such as open doors and pick up objects, which the key will be pressing E on keyboard and pressing left face button for controller. You are also able to reload, by pressing R on keyboard, but this is where I’m stuck, it’s done by pressing and HOLDING the left face button on controller. Is there any way to distinguish if the input has just been pressed or if it’s been held to determine the output? I thought it would’ve been an option in the Input settings page, like pressing a button while holding shift or ctrl, but it’s not there.

Thanks in advance!

Is this ok for you ? Do this in your controller blueprint:


Key time Hold must be superior to the time you want the key hold. Change 1,0 with the value you need

Nope, this didn’t work, I played around with the idea a bit too and couldn’t figure it out, holding the button down does nothing, it counts as 1 input as soon as it’s pressed and that’s it, so the Event Tick isn’t doing anything

You process all input in controller.
Then you create event dispatchers to your events
Then every actor that needs to know about such event connects to that dispatcher.

Or if its singleplayer game, create dispatcher in some easily referenced blueprint like game mode, make dispatcher there, trigger it from player controller, and rest is same, all interested in event connect to that dispatcher.

Thank you, but I figured it out before I read that so I’ve done it bit different, but it works perfectly though so all is good, here’s how I did it