How do I trigger this event?

  • I'm trying to make a condition that says:

    If all of the objects' value = 1, do something

    I need the event to trigger only when all of the referenced objects value are 1

    The only thing I can think of is:

    Set value "count" to (number of objects)

    Set value "count2" to (number of objects with value 1)

    If "count" = "count2" - do the thing

    Is there a simpler way?

    Thanks for any help

  • There are several ways you can do this, for example:

    Object Compare instance variable Value not equal 1 -> (no actions here)

    Else -> Do something

    Another method:

    Object Compare instance variable Value=1

    ....Object.PickedCount=Object.Count -> Do something

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So I'm not sure how many objects you have whether they are all one type or multiple types) but, assuming you have everything in a family, do something like:

    Every X seconds -> For each Family Object: add Family Object.variable to Global variable

    In another action try: System evaluate Global variable = Family Object.pickedcount --> Do XYZ (whatever your desired goal is here)

    Reset the global variable.

    Hope that helps!

    Ha dop2000 beat me to it!

  • Hey guys thanks for the help!

    I didn't know about the PickedCount function, that does exactly what I was trying to do

    thanks again

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)