Nested Key Pressed Events

This goes under the category for multiple key pressed events. I’ve looked at a few examples that suggest setting a bool variable for each key and using an AND block to check. In my situation, that will not work. The sequence matters. I need one key to be pressed first before the other key. If I were writing code, I would simply nest the key pressed events but I can’t think of a way to do that using the blueprint system. It may not be possible.

For example, in code I might do something like…

if(Key_A)
{
if(Key_B)
{
Do the thing…
}
}

or

While(Key_A)
{
if(Key_B)…
}

Any suggestions?

How about this:

On event Pressed for each key action, add a character to a string variable.
On release of the same key, get the first character in the string matching that key, and remove it from the string. Or just wipe out the whole string to empty depending on your needs.

This way, you can tell in your blueprint logic by reading through the string not only which keys are currently being held down, but also the sequence in which they were pressed.

Thanks for the reply though I think I’ve come up with a simpler setup.

After thinking for a bit, I’ve come up with this:

Basically, I use booleans as suggested to determine if a key is pressed or not, and then set a second variable for counting the hold time. If the keys are held in the correct order then the first key’s time will be greater than the second key’s time.