Pick problems and "group mentality"

Get help using Construct 2

Post » Fri Feb 01, 2013 2:06 pm

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:



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!
B
8
S
2
G
3
Posts: 83
Reputation: 2,668

Post » Fri Feb 01, 2013 2:29 pm

Add pick All condition in subevent below condition, put Your actions there
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Fri Feb 01, 2013 2:46 pm

@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.
B
8
S
2
G
3
Posts: 83
Reputation: 2,668


Return to How do I....?

Who is online

Users browsing this forum: Matthew de and 28 guests