simultaneous attack

0 favourites
  • 3 posts
From the Asset Store
Zombie attack is a survival game, where you have 2 types of games: Killer and survival.
  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Thanks again Guizmus. This makes complete sense, thanks for taking time to help and explain the fix.

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