Multiple keys pressed at the same time

I have keys 1, 2, 3 and 4 binded to four spells that fire upon pressing coresponding key. Some of those spells have continuous effect, provided i keep associated key pressed down. Something like automatic gun. Le’s say this ‘weapon’ is triggered by key ‘1’.
How can I detect if any other of those remainng three keys are pressed at same time as the key ‘1’ ? So i can stop the first spell from triggering? I may be pressing other buttons at that time, but i need to detect these four keys. Thank you.

You could use booleans to set up this with true and false for if a key is down, like this:
58162-
It would eventually look like this

Also you probably need a sequence node to spawn your spell in the first place:

Thanks! I wish i would think of that, could avoid some self pity :slight_smile:
Again, Thanks!

Go ahead and press the check mark next to the answer to resolve it if that is all you need. Welcome!

For starters I know this post is old and already answered but I wanted to add something similar I did in case anyone else runs across this. I had a similar issue, a game I am working on has real time grid based movement. I wanted the character to change direction based on the last key pressed. So I created an enum with the four directions, had each direction mapped to a different axis with scale set to times 1. Every tick I would check each of the four directions and if they were greater than zero I would UniqueAdd the corresponding Enum to an array and if not then I would remove them. Then when it came to decide which direction to move I would use the most recent item added to the list which in this case is the last index. This aloud me to hold one direction key and then press another and it would change directions, but cool enough if I let go of the new key I would start going again in the old direction. This may not work exactly how you want but I could have been a good start.

Old question, but in case anyone else wants an alternative without using variables you could try this method:

Each time a button is pressed it will check if the gate is open and enter if it is. Otherwise it will open the gate, ready for the next button to try and enter. Releasing either key closes the gate. You can expand this with another gate and sequence if you want to add more input actions.

1 Like