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"

How Do You Use Booleans to Map Two Buttons to a Single Action?


I'm attempting to map two buttons to one action multiple times such as dashing in multiple directions.

Left, Right, and Up with Down being the default for the Dash Button by itself.

So, I would need two button presses to dash left = Dash + Left

And so on.

I've been reading about how to do this and one explanation was to use booleans, but I have no idea how that works visually. I'm also a real beginner at this, so any help would be appreciated and explain with pictures if that isn't too much trouble? Or at least in a comprehensive manner.


Product Version: UE 4.20
more ▼

asked Oct 16 '18 at 12:02 PM in Blueprint Scripting

avatar image

15 2 3 6

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

1 answer: sort voted first

Sorry no pictures since I'm at work, away from my fun Unreal station.

Boolean is just true/false, on/off. So the idea is that one input action will set a boolean you create, called isDashing for example, to true (checked checkbox), and then releasing that button will set it to false (unchecked checkbox).

Then in your OTHER input actions then you have your normal movement, but at the very beginning you can split that off into doing the dash action instead by running the white wire through a Branch node with the isDashing boolean (red variable node) plugged into it, and making the False branch wire go to your usual motions, but the TRUE wire goes to your Dash motion code.

Doing it that way, it's kind of like holding the Shift key to make it so hitting letters on the keyboard types upper case instead of lower case. But with your project it's holding the Dash button (whatever that is) so that hitting directions on the keyboard will Dash instead of moving normally. Then when the button is released, then the boolean is set to false and that branch goes down the False path and does the normal movement instead.

So that's two separate graphs on your same blueprint: One for setting and clearing Dash mode (which only needs the Dash key's Input Action Event), and one where it chooses whether to do dash movement or regular movement based on if Dash mode is on (which you already have the Input Axis or Action event(s) in place for the arrow keys, just need to branch it off to act different for dash mode).

more ▼

answered Oct 26 '18 at 07:47 PM

avatar image

3.7k 18 23 20

(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