• 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] How to find non-moving units?

Status
Not open for further replies.
My fault, you needed "Current order", check this periodic example:

  • Trigger
  • Events
    • Time - Every 1.00 seconds of game-time
  • Conditions
  • Actions
    • Set Temp_Group = (Units of type X)
    • Unit Group - Pick every unit in (Temp_Group) and do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Current order of (Picked unit)) Equal to (order(<Empty String>))
          • Then - Actions
            • Do your actions here
          • Else - Actions
    • Custom script: call DestroyGroup (udg_Temp_Group)
 
Level 15
Joined
Oct 18, 2008
Messages
1,591
I used that Oo

Here it is:

  • Zombie Move
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 11 (Dark Green)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Current order of (Picked unit)) Equal to (Order(<Empty String>))
                  • (Current order of (Picked unit)) Equal to (Order(Stop))
            • Then - Actions
              • Unit - Order (Picked unit) to Stop
              • Wait 0.10 seconds
              • Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units in (Playable map area) matching (((Owner of (Matching unit)) slot status) Equal to Is playing))))
            • Else - Actions
EDIT: GOT IT! I just don't know why did that stop order make them unable to move Oo But at all now it's working... Somehow... But I think it's not usable for multiplayer :( Most of the zombies would stuck between two player -.- Do you have any idea how to solve this problem?
 
Last edited:
Make a variable called "Point" and it will be a Point variable. Make another variable called "Group" and it will be a Unit Group variable. Neither are arrays.

  • Zombie Move
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set Group = (Units in (Playable map area) matching (((Owner of (Matching unit)) slot status) Equal to Is playing))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Unit matching (Matching unit is owned by a Computer Player Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Current order of (Picked unit)) Equal to (Order(<Empty String>))
                  • (Current order of (Picked unit)) Equal to (Order(Stop))
            • Then - Actions
              • Set Point = (Unit - Position of (Random unit from Group))
              • Unit - Order (Picked unit) to Attack-Move To Point
              • Custom script: call RemoveLocation( udg_Point )
            • Else - Actions
      • Custom script: call DestroyForce( udg_Group )
This will order every unit owned by a computer player to attack to a random unit on the map. Let me know how it works.

MAKE SURE the Custom sripts I gave you are exact! They are case-sensitive.
 
Yeah, so here's what you do:

Create another trigger with the event "Unit - A unit is attacked"
For the actions do "Set custom value of Attacking Unit Unit to 10"

Change the timer-trigger to this:

  • Zombie Move
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set Group = (Units in (Playable map area) matching (((Owner of (Matching unit)) slot status) Equal to Is playing))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Unit matching (Matching unit is owned by a Computer Player Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set Custom Value of (Picked Unit) to (Custom Value of Picked Unit - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Custom Value of (Picked Unit) Less than or Equal to 1
              • Or - Any (Conditions) are true
                • Conditions
                  • (Current order of (Picked unit)) Equal to (Order(<Empty String>))
                  • (Current order of (Picked unit)) Equal to (Order(Stop))
            • Then - Actions
              • Set Point = (Unit - Position of (Random unit from Group))
              • Unit - Order (Picked unit) to Attack-Move To Point
              • Custom script: call RemoveLocation( udg_Point )
            • Else - Actions
      • Custom script: call DestroyForce( udg_Group )
So now, it will only order a zombie to attack -move some random place IF it has not attacked someone in the last 18 seconds.
 
Status
Not open for further replies.
Top