x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.20
Tags:
more ▼

asked Nov 09 '18 at 07:34 PM in Blueprint Scripting

avatar image

SeldinG
1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

alt text

button-setup.png (102.0 kB)
more ▼

answered Nov 10 '18 at 02:17 AM

avatar image

SeldinG
1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Nov 09 '18 at 07:42 PM

avatar image

mightyenigma
3.7k 18 23 20

avatar image SeldinG Nov 10 '18 at 02:13 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question