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

How to make unit dies when it has 0 mana

Status
Not open for further replies.
Level 16
Joined
Mar 25, 2016
Messages
1,327
Use a unit group and check for targets mana, or dynamically create unit-mana events. I recommend the first one, because it is easier in GUI.
The second one is more efficient and more accurate (units are killed instantly compared to the next timer call)

  • Mana
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Air Plane)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • (Mana of (Picked unit)) Less than 0.01
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
-1 mana per second can be done in object editor (destroyer also has negative mana regeneration)
 
Level 11
Joined
Jul 17, 2013
Messages
544
Im too noob to create tiggers in editor is there a way i can cope them? or could u just send them in a empty editor map so i can copy them to my map i just cannot find all those things in editor
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
You can put them in one trigger. Simply add to the two conditions an or-statement and add all your unit types there. You then have to change the unti group function to pick all units of the map.
Should not lag. It highly depends on the amount of units on your map and your other triggers
 
Status
Not open for further replies.
Top