• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Order a group of units to destroy one base, then move on to another one?

Status
Not open for further replies.
Level 27
Joined
Nov 5, 2010
Messages
1,405
Hey everyone. So I'm making a map where I want a group of Dragons to attack some bases, and I have to defend them. What my question is, how do I sort of, force them to destroy everything in that base, and then move on to another one if they succeed?
I used a trigger ''Order (Picked unit) to attack-move to (center of some region)'', but when they attack, after some time, they return to where they were at the beginning.
Thanks in advance.
 
Level 17
Joined
Jul 1, 2010
Messages
720
All units belonging not to a human player will return to their original spot after being issued a target point order, except for players with AI scripts, since then the AI will tell them what to do even if they have an issued target order.
Basically I can think of two ways:

Check periodically (say every 2 sec) if the units and buildings in the base area are dead and if so make the dragons attack the second base and so on...
Or you can check periodically (say every 2 sec) if all the dragon's current order is "attack" and if it's not order them to attack. This is just something simple so you might want to improvise. Hope this helps.
 
Level 27
Joined
Nov 5, 2010
Messages
1,405
Well, I used this, and it worked pretty well, so I think I'll just keep using this, but I may change something. Thanks for help everyone ^^

  • Events
    • Time - Every 2.00 seconds of game time
  • Conditions
  • Actions
    • If ((Number of units in (Units in Base1 <gen> owned by Player 6 (Orange))) Greater than or equal to 1) then do (Unit Group - Order NetherGroupOne to Attack-Move To (Center of Region 003 <gen>)) else do (Unit Group - Order NetherGroupOne to Attack-Move To (Center of Region 012 <gen>))
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
i think those periodic events will make the map slow my system will be 3 trigger but it will be a better system i think
  • Start triggers
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 6 (Orange)) and do (Actions)
        • Loop - Actions
          • Set Unit_group = (Last created unit group)
          • Unit Group - Add (Picked unit) to Unit_group
  • add unit
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
    • Actions
      • Unit Group - Add (Triggering unit) to Unit_group
  • base
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of Unit_group are dead) Equal to True
        • Then - Actions
          • -------- Order unitgroup to move to next base actions here --------
        • Else - Actions
 
Status
Not open for further replies.
Top