• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Health Below X

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2007
Messages
313
I am trying to do a trigger like this, but I don't know how.

  • Events
  • Unit - Any unit belonging to Player 2 (Blue)'s Health falls below 50
  • Conditions
  • Actions
  • Unit - Order (Triggering Unit) to Move to (Random unit from (Units in (Playable map area) owned by Player 1 (Red)))
The bit I am having trouble with is the Events part. When I go to the Units tab under Events, and then go to the life selection, it will not let me do something like (Random Unit From Unit Group). The only way units I can select are (No unit) and a specific unit determined by a variable.

Let me put it more clearly. I want to make a computer who controls units make a unit that is badly injured retreat. How can I do this?
 
Level 8
Joined
Jul 23, 2005
Messages
329
You could do it via periodic triggers, like so:
  • Untitled Trigger 001
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set AntiLeakGroup = (Units owned by Player 2 (Blue))
      • Unit Group - Pick every unit in AntiLeakGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Picked unit)) Less than or equal to 50.00
            • Then - Actions
              • Unit - Order (Picked unit) to Move To (Wherever)
            • Else - Actions
              • Do nothing
 
Level 3
Joined
May 28, 2007
Messages
57
The Variable AnitLeakGroup is just a unitgroup variable and to set it just go to (units owned by(Than choose Player 2 Blue)) and for the Life of picked unit go to your conditions and go (Real(Life of(Change it to Picked Unit))) Less than equal to 50.
 
Status
Not open for further replies.
Top