How can i disable a key when inside a trigger?

Hello, how can i disable a key, ‘‘W’’ (in my case) when my character is inside a trigger box? I want to disable it for only a couple of seconds and then everyhting to back to normal, i think the blueprint should be pretty simple but i haven’t found a solution yet! Any help is greatly appreciated!
Thanks!

your trying to disable the W and only the W right?

if thats the case then it may be easier to modify the effect the input usually produces. to that end what does the input do in your case?

I can see two ways to handle this:

  • First one would be to clear the W key in your action map that you use with W. In other words, instead of using “Input W” node in your pawn/controller code/blueprint, you use an action mapping: go to Project Settings → Input and create a mapping lets say “Move Forward” and map it to W (this way whenever you press W you will fire the “Move Forward” event in your controller or pawn. This way you can at runtime clear the W key map to the “Move Forward” event and then add again when you want to.

  • Second one, easier in my opinion, would be to add a Branch node with a bool “Is_W_Active”, default to true, right after you Input W event, and whenver you want to stop the W key from working you change the “Is_W_Active” variable to false and the branch node won’t let key do what it usually does.

Good luck in your project,

Cassio

you could always make a bool variable and make it true if you are in the trigger box. use a branch to say, if you are in trigger box do nothing, if you are not in the trigger box and “W” is pressed do something.