• 🏆 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!

How to make unit dies when it has 0 mana

Status
Not open for further replies.
Level 15
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 15
Joined
Mar 25, 2016
Messages
1,327
Replace footman with your air plane unit. You can change the timer interval to smaller numbers, if you need more accuracy.
 

Attachments

  • AirPlanes.w3x
    16 KB · Views: 32
Level 15
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