Pick problems and "group mentality"

0 favourites
  • 3 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'm having fun prototyping some group AI behaviours. However, as a Construct newbie, I'd really appreciate a bit of advice with regards to the picking process.

    I have a number of autonomous enemy agents that maintain their own state based on individual factors like:

    • Distance(Player.X, Player.Y, Enemy.X, Enemy.Y) > 50 --> Enemy Set Safety to "Moderate"
    • Enemy Health < 10 --> Enemy Set Action to "Search for Medikit"

    But now I want to add some state transitions for individual enemies based on assessment of all enemy instances, not just themselves.

    For example, suppose that I wanted to implement the rule that "If more than 80% of the blue team have less than 30 health, then all blue players should run away". If I try to implement this as:

    <img src="http://i46.tinypic.com/2a7s8eq.jpg" border="0" />

    Then my problem is that the evade state only gets applied to the picked instances - i.e. those with less than 30 health. How do I create an event that compares the number of instances that would be picked by an expression (how many blue players have <30 health, are "fleeing", or have less than 5 bullets left, for example), but then apply the corresponding action to all instances of that object?

    Any help gratefully appreciated!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add pick All condition in subevent below condition, put Your actions there

  • vee41 - that is exactly what I was looking for, thankyou!

    I didn't see "Pick All" because I was looking in the Object conditions (where you find Pick by ID, Pick Nearest/Furthest etc.) rather than in System conditions.

    In fact, it it only me that finds it a bit counter-intuitive that you have to Pick All in "System" and then select the object type that you want to pick all of, rather than going via the object itself? Anyway, it works, so thanks again.

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