Has anyone tried this method to make an input action trigger after a set amount of time? I’m trying to get my character to go prone when the Crouch button is held down after a short amount of time, instead of tapping it. I’m trying to save on button mappings for game pads while also keeping the ability to remap down the line by not using the “is key held” function, as some users have stated that this can prevent/break remapping at a later date.
I have C and Gamepad Face Top button mapped to make character crouch, and I would like the player to be able to enter prone by holding those same buttons instead of tapping them, which would still be to enter crouch. Does anyone know of a proper config for this to work?
I can also post some photos of my current blueprint when I get home, if that helps, however I am at work right now and don’t have access to my project.
Here is a screenshot I have of my current blueprint. I already have crouch functioning fine when C is pressed. It goes in and out of crouch by just tapping C.
What I’m trying to do is have the player hold C, so that the character then goes into prone, like any shooter game nowadays. I don’t want to remap prone to another button, because it seems like a waste of space to me, which is probably why a lot of games use the “hold” function.
There is a “input key held” function, but it specifically makes you choose what key to hold. Instead, I’m trying to find a function that takes the input action of crouch and when the player holds whatever button is used to crouch, no matter the mapping, the character goes into prone.
The delegate function I have in there is wrong, as it sets a timer so far to initiate prone, but it has nothing to do with the button being held down. It just initiates prone after the set time, no matter how long the button is pressed.
OK i just got your comment. I wrote you from home and I don’t have Unreal in my home PC. However, I play with the Paint to show you how i would do it from your images. Have a look on my 2 images.
Ah, ok, I think I’m getting it. Do I still need to use the delegate function so I can adjust the length of time to hold the button to initiate crouch, or is that the wrong node? Your setup makes a lot of sense though. Thanks again for helping!
I’m having a problem setting it up as I still don’t know how to set the time aspect. I’d like to have the player hold the crouch button for about a third to half of a second to signal the prone state, but I’m having trouble finding the proper node for that.
Hey! Sorry for the long delay! I had a rush at work today and Yesterday. Tomorrow i will more focus to your question. However, i suggest you to try to improvise the nodes the Get Player Controller node and the Get Input Key Time Down node.
Easiest way to do all this is with a timer event or function you don’t even need to use event tick . When you press the button simply have the timer add 1 to a variable eg fingerHold duration . Then check if fingerHoldDuration > desired held time if true continue with logic. Then from released simply clear timer , reset the variable back to 0 . One thing you need a do once before the event timer otherwise the loop of the event will fail to execute as it will keep trying to call the event but never actually execute the logic . This had me stuck for ages .
I’m guilty of overthinking this one too. Same concept as going prone, I just want to hold an input to use a bandage to stop bleeding. I’ve got a five second long timeline that will only finish if the desired button isn’t released. Hold time you can ignore, as well as the update execution (unless you want to drive HUD changes there).