How do I Evaluate that none were picked?

0 favourites
  • 11 posts
  • Having trouble figuring out how to pick objects based on a certain type, but then do something when there were none picked.

    This doesn't work.

  • Should work that looks correct. Use an action to set a variable to pickedcount to find out what it's finding.

  • I know this works...

    but I'm just wondering how to reverse the logic so that the event in which there are none then a set of actions happen - but not in an ELSE statement.

  • The event you posted originally is the event in which there are none picked so you already have it. If it didn't work as expected then it means it found at least one, so set a variable or text to pickedcount to see what value it's finding, it can't be 0.

  • I believe PickedCount=0 does not work by design as PickedCount only returns a value when there are objects picked.

    Else is the only way.

  • its just awkward looking...

    here I'm saying if there are no drone owned by the player's ship, then spawn one. There has to be a more logical way to do this.

    its somewhat offensive as a programmer to look at this!

  • The reason the pick all doesn't return 0 is because the pick event doesn't actually even run if there are no instances.

    You can use the inverted comparison though to avoid the else.

    Of course that still only works if there drone instances of some sort.

  • its just awkward looking...

    I use "Pick... Else" method all the time. Yes, it looks awkward, but it's the easiest way to do this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • calminthenight oh that's interesting! I actually like that...

    dop2000 good to know, it's just feels very fake or like it exposed something that the engine never intended to do. Seems like if there was they would have made a special case Event for it. Like: 'None Picked' or 'Pick doesn't exist'

  • You could also do it with a local variable, but it’ll still be two events.

    Local number any=0
    Sprite: x=33
    —— set any to 1
    ——do something

    The else one isn’t bad. It lines up pretty good with the logic of picking.

    The main rough spot with the picking system is the top level event picking of newly created objects.

  • The main rough spot with the picking system is the top level event picking of newly created objects.

    right, there would have to be a special event similar to "Once While True" or something that would run if no objects were picked in an evaluation. But that would probably break something!

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