How do you disable a specific input for a certain amount of time?

So basically I have this “time slow down” function in the game where you press Q and it will slow down time(and enemies) for 3seconds. This is working perfectly well. But what I want t do is disable “special attack” button (right mouse key) while the time is slowed down. I am really inexperienced with unreal engine so plz tell me in noob terms. Thanks!

Well there is a simple way which will work right now and can be easily understood by a beginner.

As your project grows it may be necessary to design more of an architecture which answers questions like this, but that’s a problem for another day.

What you can do immediately is make a boolean which correlates with your time slow down being active. You might refer to this boolean as a “flag” because you are essentially waving a flag to say, “hey, this thing is true right now!”

So when you enable the time slow down, also make this boolean true. And when you stop the slow down, make this boolean false.

Then over on the special attack input event, before the logic of the event goes, take that boolean and put it into a branch node. If the branch returns true, then you do nothing - i.e. do not run the logic. If it is false, that means that the flag is not active, so you can run the logic.

2 Likes

wow it worked. you are good at explaining things in easy way. thank you!

2 Likes