Download

How to disable input only for an specific input ?

I’ve set my character up so it can equip a sword and unequip it by pressing the related Action Input key < F > , First time pressing F will equip the sword , second time pressing F will unequip the sword .
But now i want to prevent the player from being able to spam the F key until the equip/unequip animation is finished which takes about 2 seconds . but the problem is i cant use the "Disable input " node since it will disable all the input received by the character . for example if the character is running and decides to unequip the sword , the character will stop moving since the “move forward” button will also be disabled by “Disable input” .

So how can i only disable this specific input ? thanks.

I kinda solved this problem with do-once node , so first time pressing F event will fire ,then it gets locked , then after 2 seconds it resets .

But for the sake of knowing , back to the original question , is there anyway to disable input only for one key ?

Make bool variable, Set it to True when you start anim, set it to false when you finish it
On input event check if var is true or false, use branch to either accept input or decline.

Also there should be way to find out if animation is playing.

Ps. if you have multiple animations that you want to ignore, instead of bool use integer.
Increase it when any of anims starts decrease when it ends,
Accept input only when that integer variable is zero.

Since all the animations and stuff happens in Animblueprint and i dont know how to find out if an animation is finished playing or not and all of my setup (except the animation) happens in character blueprint, i think do-once would be more efficent and easier way for this . but thanks for the response .

Is there some node like “Disable input” , something like " Disable Specific Input " , which only disables that specific input ? i mean not disabling it indirectly with do-once, or making a bool for it , or anyother way ,something to directly disable one specific input , just like “Disable input” disables all the inputs received , but just for an specific key ? Thanks

Ps. just a thought ,i think we could check for the “Current Time Ratio for …” in AnimBlueprint to see if the animation is finished or not .

I not sure if they are a “Disable input” node, but use a do-once or a flag boolean is a fine and perfect way to do it.