Announcement

Collapse
No announcement yet.

Boolean Logic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Boolean Logic

    Click image for larger version

Name:	string_boolean.png
Views:	1
Size:	145.7 KB
ID:	1141039

    Hi I am trying to figure this out. What I would like is for when ever you press F the boolean would change from true to false if it is true, and then from false to true if it is false. It is constantly bringing up False.

    -Robert

    #2
    Just use the "FlipFlop" node Atm you are just going through the entire sequence -> so it will go to true and some seconds after that to false - when you press again it will do the same thing

    Click image for larger version

Name:	flip.jpg
Views:	1
Size:	35.3 KB
ID:	1061299

    Comment


      #3
      The reason this is happening is because sequence executes everything in the chain one after another. You're first ensuring the boolean is true, then ensuring the boolean is false. You'll want to make them come off the same branch. True will make the boolean false, false routes to true. You can just drop the sequence and everything executed by Then 1.

      Flip flop is a great way to do this, but you can also use the NOT boolean node which will simply toggle your boolean to be whatever it wasn't when you set it.
      iTween For UE4
      Procedural pathed animation for actors, components & UMG - $0
      Runtime DataTable
      DataTables dynamically loaded from text or Google Sheets while your game is running!
      easyCSV
      Fast, cheap, and accurate CSV parsing at runtime!

      Comment


        #4
        Thanks guys!

        Comment


          #5
          Now what if I wanted to say switch between ABC or any other amount of options after that?

          Comment


            #6
            Originally posted by Fighter108! View Post
            Now what if I wanted to say switch between ABC or any other amount of options after that?
            Could you probably give an example of what exactly you mean?

            After that you could use another "FlipFlop" node to change some other bool variables. Or a switch, sequence, branch.....

            Comment


              #7
              Originally posted by Fighter108! View Post
              Now what if I wanted to say switch between ABC or any other amount of options after that?
              You can store whatever desired selection you want in an integer instead of a bool.

              Click image for larger version

Name:	a7f7a5cc4b.png
Views:	1
Size:	29.3 KB
ID:	1061372
              Works similarly to switching on an enum.
              To cycle through 3 options, you'd have something like this (obviously with actual code being executed before setting the variable).

              Click image for larger version

Name:	7e96f8d913.png
Views:	1
Size:	71.1 KB
ID:	1061373
              Last edited by Xendran; 11-23-2014, 03:57 PM.

              Comment


                #8
                Hello,

                Two years late, but an easy way to switch between 3rd, over the shoulder, and 1st person cameras, is to just move the Follow Camera and use two FlipFlops. Attach "Over the shoulder location" to A of the first FlipFlop, then attach a second FlipFlop to B, then attach "1st person location" to A of the second FlipFlop, and "3rd person Location" to B of the second FlipFlop. This will cycle between 3rd, to over the shoulder, to 1st, then back to over the shoulder, then back to 3rd, and repeat. This works for as many camera positions as you want. You don't need to use multiple cameras, or make this complicated. You can also smooth out the transitions, but not really needed. Most solutions use the mouse wheel, but this works good enough for a gamepad.

                Click image for larger version

Name:	CameraMove.PNG
Views:	1
Size:	135.3 KB
ID:	1114470
                Last edited by CrashA51; 09-02-2016, 05:42 PM.

                Comment


                  #9
                  Click image for larger version

Name:	68177b1e2405d54d96bb50f387df4b80.png
Views:	1
Size:	32.6 KB
ID:	1127350

                  This is an old thread, but I wanted to post what I think is the most convenient way to toggle a boolean back and forth. This is especially useful for me because the blueprint this is used in will be instanced many times throughout my levels and the boolean could be either true or false when the game starts depending on the instance, so i needed generic code to just flip it no matter what it started on. Hope this helps someone!

                  Comment

                  Working...
                  X