How to disable a specific key input and action mapping/keys for a certain amount seconds?

After I click play on editor, I want to disable a certain input key only for a certain amount of seconds at the beginning of every “play”. Aside from that, I would also want to disable any action mapping/keys only for a certain amount of seconds at the beginning of every “play”. Any help would be appreciated.

After I click play on editor, I want
to disable a certain input key only
for a certain amount of seconds at the
beginning of every “play”.

The most straightforward solution would be to have a flag that does not let things go through:

Start with the bool set to False and set it to True after 5s.


Aside from that, I would also want to
disable any action mapping/keys only
for a certain amount of seconds at the
beginning of every “play”. Any help
would be appreciated.

You could disable input for a specific actor or for the entire player controller like so:

301504-annotation-2020-05-09-093214.jpg

Depends on how and where the input is used. Use a timer to enable it again.

Thank a lot for your reply. I put the 'flag" code from the first pic on a level blueprint. I tried it and it disables the input even if the desired “seconds/time” has passed. What can be going wrong here? As for the second blueprint pic, I want to disable just the Action mapping for a small amount of time and not the Axis mapping. Is this Possible?

Thank a lot for your reply. I put the
'flag" code from the first pic on a
level blueprint. I tried it and it
disables the input even if the desired
“seconds/time” has passed. What can be
going wrong here?

Not sure if I follow, can you show the blueprint?

As for the second blueprint pic, I
want to disable just the Action
mapping for a small amount of time and
not the Axis mapping. Is this
Possible?

I don’t think these 2 can be separated.

Good that you informed me about the axis mapping. So, now there can possibly be another approach instead of trying to just disable one “Mapping”. Now, below is the blueprint I was attempting with flags for you to see.

Is it possible to disable input keys separately? Below there are two pics of me attempting to do the disable and then enable after a few seconds. Just two different approaches. They both disable the desired input key(s). The first one below disables both key press, but the only problem is trying to make the pressed inputs usable after desired seconds.Which also applies to the last one.

Now, below is the blueprint I was
attempting with flags for you to see.

So what happens after you press 5? Put a Print String after True and it should work fine once the time has gone. Also, it’s not a good idea to handle input in the Level Blueprint. Is there a reason you have it here?

Also, how do you know the keys are not working? You do not seem to be executing any logic here.

Yes, totally. I was only testing it out on a level bp since it wasn’t working on the character bp. I usually place trigger-able mesh objects into level bp.

I have a paused screen that gets called from a character bp. So at the beginning of every begin play, the player will not be able to pause screen unless desired seconds have passed. Originally, I had a eventbeginplay linking to sequence that creates a widget and adds it to view-port, but removed it temporarily to test out the code below. I did the code inside the character blueprint again and still nothing. Even with a print string node right after TRUE, no message.

I was only testing it out on a level
bp since it wasn’t working on the
character bp.

And that’s the real problem here. If you use the same input in 2 blueprints, one of the inputs will be consumed, preventing the other from working. The 5 in the level blueprint will receive priority and the character will not receive the call.

Handle the input in one place only. The original script I posted works fine. Do note that you need to have the timer with the bool in the character BP, you cannot have the variable in the LB and the keypress in the Character. This is not a global block, it works selectively for the input it is attached to in this particular blueprint.

Please try again.

Image from Gyazo

Mashing F above, as if my cutscene life depended on it! :wink:

Hehehe, Thanks again for your time, patience and effort to help! When I was testing out the code yesterday, I forgot to remove a bp code that contained information of input key “5”. I was on the other side, very much on the bottom of the Level BP event graph.

Finally did the same code again and print string was working out just like you said it should! After that, I was messing around with it to get the desired functionality. I happened to put Disable right after event begin play, but before Set Timer, and Enable right after Timer. :]