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!