• 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.

[Trigger] Mass Unit Commands

Status
Not open for further replies.
Level 9
Joined
Feb 2, 2013
Messages
97
Hi guys,

I want a 3 skills, one for making all units of the skill using player hold postion, one for attack at a pickable point, and one to move to a pickable point.
My first idea was to create a tower for each player (also a trigger for each player, this one is for red), give him 3 spells with matching names, and than do stuff like this:

TowerHold
Events
Unit - A unit Start, Cast a spell
Conditions
(Owner of (Triggering unit)) Equal Player 1 (Red)
(Ability being cast) Equal Hold Position ALL
Actions
Einheitengruppe - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Unit - Order (Picked unit) to Position halten)

It doesent work, why?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
- The event should be "Starts the effect of an ability".
- The condition "(Owner of (Triggering unit)) Equal Player 1 (Red)" shouldn't be there.
- The unit group leak should be removed.

This works for all players:
  • Hold Position
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hold Position
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Hold Position
And
  • Move
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Move
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Set TempLoc1 = (Target point of ability being cast)
          • Unit - Order (Picked unit) to Move To TempLoc1
          • Custom script: call RemoveLocation( udg_TempLoc1 )
And
  • Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attack
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target unit of ability being cast) Equal to No unit
            • Then - Actions
              • Set TempLoc1 = (Target point of ability being cast)
              • Unit - Order (Picked unit) to Attack-Move To TempLoc1
              • Custom script: call RemoveLocation( udg_TempLoc1 )
            • Else - Actions
              • Unit - Order (Picked unit) to Attack (Target unit of ability being cast)
If you can't get it to work, use debug messages!
They're one of the most important tools of anyone who is trying to program something.
There's a very nice tutorial on that subject. If you follow all that, you might be able to fix your own problems in the future :D.
 
Last edited:
Status
Not open for further replies.
Top