Does this picking look right?

0 favourites
  • 7 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • I want this event to happen when the count of Resources (that are NOT "pp") is more than 0

    I'm getting some wonky results, so just wanted to make sure this looked right to ppl. I can't really find doc on this...

  • you have to add

    above the

    in order for the

    to be true.

    otherwise your count will always be with 1 or 0, 1 being whenever any of the "resources" will have any other value but pp.

    and you need the loop, so you can check each "resource" and not check collectively as 1 object if this makes any logic to you?

    or instead of for each use "pick all" followed by your 2 other conditions

    that was so convoluted and stupid ... reposted bellow

  • GeorgeZaharia that's interesting... so just saying Resources != "pp" won't actually pick them?

    So I have a few state changes where I need to check if there are resources out (minus the "pp" ones), and I'm checking every tick. Maybe its better to make "pp" resources be a different object type? There are 4 other resource types in the game, "pp" are just production points "coins" that only the player can collect. The AI should ignore those...

  • GeorgeZaharia that's interesting... so just saying Resources != "pp" won't actually pick them?

    So I have a few state changes where I need to check if there are resources out (minus the "pp" ones), and I'm checking every tick. Maybe its better to make "pp" resources be a different object type? There are 4 other resource types in the game, "pp" are just production points "coins" that only the player can collect. The AI should ignore those...

    ehm yes? .... just saying Resources !="pp" won't actually pick them, i mean it will pick them all , indifferently if they have value of "pp" or not. since you didn't mentioned which of them?

    Edited: and while it picks all of them, the conditions you added bellow, will get you nan or it will count as 100 or what max number of instances you have since you are not looping trough all of them, picking 1 by 1 and checking their values, i think the pick all a temporary array and checks all instances. then counts them based on the comparison inserted.

    but yea if you don't use the solution in my capx bellow and you want to use a custom method like above, you have to use a loop, so it checks every item at a time, otherwise the systems counting overwrites and picks all with the last value of the last object.

    so here is my example capx... in C3 i used picked by comparison system expression and you won't need the 2 other functions you used there

    also in C3 != is actually <>

    example picking instances based on value

    event line 8 is what you need to replace your conditioning in the picture.

  • ah okay, so I changed the amounts to be mostly "pp" and added this as a trigger to tell me if I had any non-pp resources... works well! Thanks GeorgeZaharia!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • GeorgeZaharia I thought this was working...maybe its not? but I noticed there's no way to say not-onscreen in the evaluate expression. Any ideas of what I should do instead?

  • GeorgeZaharia I thought this was working...maybe its not? but I noticed there's no way to say not-onscreen in the evaluate expression. Any ideas of what I should do instead?

    right click on "is on screen" and select inverted that counts as not on screen

    Edited: you mean the Else? i think Else needs a secondary condition in order to work properly like

    Else
    Inverted X Is on screen
    

    add me on discord if you have more questions :) i got a coffee and nothing to do, il be around for a couple more hours.

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