• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Trigger] Gui quickie: Check health in unitgroup

Status
Not open for further replies.
Level 4
Joined
Jan 29, 2007
Messages
98
This'll do just that :D
Just change the Unit Group to match your needs :D
  • Unit with Least HP
    • Events
      • Player - Player 1 (Red) types a chat message containing -check hp as An exact match
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area))
      • Set TempReal = 1000000000.00
      • Unit Group - Pick every unit in TempGroup 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 TempReal
            • Then - Actions
              • Set TempReal = (Life of (Picked unit))
            • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
^You forgot to store the unit :)

  • Who has it
    • Events
      • Player - Player 1 (Red) types a chat message containing mo as An exact match
    • Conditions
    • Actions
      • Set TempUnit = No unit
      • Set TempReal = 1000000.00
      • Unit Group - Pick every unit in (Units in (Playable map area)) 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 TempReal
            • Then - Actions
              • Set TempReal = (Life of (Picked unit))
              • Set TempUnit = (Picked unit)
            • Else - Actions
The unit with the least (absolute) HP will be stored to TempUnit.
 
Level 25
Joined
May 11, 2007
Messages
4,650
^You forgot to store the unit :)

  • Who has it
    • Events
      • Player - Player 1 (Red) types a chat message containing mo as An exact match
    • Conditions
    • Actions
      • Set TempUnit = No unit
      • Set TempReal = 1000000.00
      • Unit Group - Pick every unit in (Units in (Playable map area)) 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 TempReal
            • Then - Actions
              • Set TempReal = (Life of (Picked unit))
              • Set TempUnit = (Picked unit)
            • Else - Actions
The unit with the least (absolute) HP will be stored to TempUnit.

Thanks :) +rep!
 
Status
Not open for further replies.
Top