i am trying to set up an action input event to enable crouching when pressed, or toggle prone when held for a duration of roughly a second, however, i am having a hard time figuring out a good way to go about this, i am using flipflops for the toggle of crouch and prone, attempted to use the “get input key time down” node to get the duration of the input key being down, running that through a timer by event which is cleared and invalidated upon keypress or successfully firing off an action, and i can get prone/unprone to delay properly on a keypress but its just not working right
is there any easier way to toggle crouch when the action input invent is tapped for less than a second, and toggle prone when it is held for longer?
Crouch on press.
After crouch animation finished if button is still pressed then proceed to prone pose.
This is how it was made on earlier versions of Metal Gear for example.
that would work, however what if you are already crouched and wish to go prone? then it would not work… i think the best solution would be to set it up so if pressed for 1 second, you prone, or stand up if already prone, and releasing it before that 1 second is up you crouch instead, and the input key time down might be the key, but if i try using a float >= float it wont work because the second you push the button it will register the shortest possible duration and never register as a 1 second press
i almost got it to work with a retriggerable delay… when pressed it starts a retriggerable delay which upon completion sets a boolean to true and then continues to trigger the events relating to prone, right now they are just print screen nodes… upon releasing the input, if the timer isnt completed, that boolean isnt set to true, and if a branch reads this boolean is not true, it performs the functions related to crouching… if this branch reads that the timer did in fact complete and the boolean is true upon releasing the key, it resets the boolean back to false.
but apparently the delay doesnt actually stop when the button is released, a custom event timer maybe?
alright… the problem i had with the above script is the delay would continue to complete even after the button was released, so i added a branch to invalidate the delay if the crouch key is depressed upon completion, and this seems to work out now exactly as intended, but if anybody has a simpler solution, id really like to know… but here’s what i have and what’s working so far… this i guess will be the final layout of the script, if anybody else wants to be able to map multiple functions to the same key which is extremely helpful with controller configurations, here it is
Sorrry to bring up an old post but I had a similar problem this week where I wanted to go from standing to crouching if the key was just pressed but if held down - go to crouching then to prone. I then wanted to be able to come back to standing… The conditions I needed it to meet were - if only tapped and are standing go to crouching, if only tapped and crouching go to standing, if only tapped and prone go to crouching, if held down and standing go to crouching, if held down and crouching go to prone and to not require the player to release the key and only hold it down longer if they wanted to go from standing to crouching to prone
This is my solution
As it seems I cannot upload the uasset and the text export is too large I will attach additional screen shots zoomed in