Announcement

Collapse
No announcement yet.

Combining two conditions

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

    Combining two conditions

    Hey, I´m pretty new to UE4.

    I created a class blueprint with three red colored pointlights, two of them are surrounded by triggerboxes. When I get close to one of them and enter its triggerbox, the respective pointlight turns green. As a result of both pointlights being green I´d like to have the third one turning green as well. How do I need to set this up? And how would I need to do it, if it should only work in a specific order (first light 1, then light 2)?

    Thanks in advance and best regards.

    #2
    google for BOOLEAN ALGEBRA.

    You have nodes: AND, OR, NOT, XOR , pick those binary versions.

    First check if light color is equal some value (type == to get equal node, or just "equal")
    Do that for all lights.

    Then light A and Light B result , and use branch node, there you have if its true or false.


    Or you can use loop.

    - get all actors of class (select class of your lights).
    - then check if light color is equal to value you want.
    - every time its equal increase some integer counter variable
    - if that counter is >= 2 then light last one

    Comment


      #3
      Well, which exact nodes do I need to plug into the Equal Boolean node? I´ve got now two OnComponentBeginOverlap (Trigger 1 & 2) plugged into two SetLightColor (Target Pointlight 1 or 2). These are both plugged into the Exec of a Branch and the EqualBoolean is connected to the Branch´s condition. The true Exec of the Branch is plugged into another SetLightColor for the third pointlight.

      Comment


        #4
        Originally posted by CotySA View Post
        Well, which exact nodes do I need to plug into the Equal Boolean node? I´ve got now two OnComponentBeginOverlap (Trigger 1 & 2) plugged into two SetLightColor (Target Pointlight 1 or 2). These are both plugged into the Exec of a Branch and the EqualBoolean is connected to the Branch´s condition. The true Exec of the Branch is plugged into another SetLightColor for the third pointlight.
        A screenshot would save so much time

        Comment


          #5
          True! Well that´s how it currently looks:

          Click image for larger version

Name:	boolean.jpg
Views:	1
Size:	155.4 KB
ID:	1115975
          Last edited by CotySA; 09-27-2016, 07:07 PM.

          Comment


            #6
            You need to use 2 variables. One for Light1Green? and one for Light2Green? - and instead of using the == node, you need an AND node to check if they are both green.

            Comment


              #7
              This worked, thanks! And how would you set it up, if it should only work, if I toggle the lights in a specific order?

              Comment


                #8
                Or just use single INTEGER variable. Set it to 0 at start, then increase (+1) for every matching color. Then check if that integer is more than 2 or not.

                Comment

                Working...
                X