simultaneous attack

Get help using Construct 2

Post » Mon Feb 24, 2014 12:32 pm

Hi,

I'm still messing about with the RTS template (in-case you've seen my other posts).

I'm having trouble with my Friendlies when I set two or more to attack Enemies at the same time.

Scenario: I select one Friendly and send it off to attack an Enemy. I then quickly clear selection, select a different friendly and send it off to attack the same or another (behaviour the same). Whichever one reaches an Enemy first will start attacking, the other will simply stop on it's path.

From this point the first Friendly becomes 'dominant' and whenever it is given the same target as another Friendly the other friendly will not attack the enemy, even if it reaches the target first.

capex

Pulling my hair out here. can't seem to see what I've messed up.

In debug I see the vars congaing the states seem fine, but event just don't fire.

/Jamie
B
5
S
1
Posts: 34
Reputation: 364

Post » Mon Feb 24, 2014 12:39 pm

Ok, so your problem comes from the event number 12. There, you select all the moving friends, then filter them using the boolean "isEngaging". The problem is in your comparison after that. You compare distances using the Friend.X, Friend.Y, ... When you do a system comparison (like here), it should be known that, when multiples elements are selected, only the one with the lowest UID is used in the calculus. In your case, you have a selection of 2 moving friendly units. When the first one reaches the enemy, the condition is verified, but you still have the 2 moving units selected, so the "Stop" event 14 is applied to both units.

What you want : use a forEach condition on event 12 (yes, add the condition with the 2 other ones already there), and the events will be evaluated for each moving friendly unit, individualy.
B
17
S
8
G
4
Posts: 473
Reputation: 6,211

Post » Tue Feb 25, 2014 1:43 am

Thanks again Guizmus. This makes complete sense, thanks for taking time to help and explain the fix.
B
5
S
1
Posts: 34
Reputation: 364


Return to How do I....?

Who is online

Users browsing this forum: DolyGamesCosmos and 28 guests