• 🏆 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 to kill all of one type of unit in a region

Status
Not open for further replies.
Level 2
Joined
Jan 5, 2019
Messages
7
I'm trying to make a trigger that can kill all of one specific type of unit in a region at dawn. The event is simple enough, but I can't find any way to get the game to kill the unit type. More specifically, there's a custom unit called "Zombie", and when the time of day is 6:00, I want every "Zombie" to die. Making a condition that triggering units are of type zombie, and then making an action to kill triggering units doesn't work for some reason. What am I doing wrong?

I looked up previous posts about this but they were of no help.
 
If the event is

  • Game - The in-game time of day becomes Equal to 6.00
then there is no 'Triggering Unit'.

Here are the actions you need:

  • Actions
    • Set TempGroup = (Units in RegionName)
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • Set TempUnits[0] = (Picked unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of TempUnits[0]) Equal to Zombie
          • Then - Actions
            • Unit - Kill TempUnits[0]
          • Else - Actions
    • Custom script: call DestroyGroup(udg_TempGroup)
 
Level 11
Joined
Nov 23, 2013
Messages
665
I think you should use the action 'Unit Group - Pick every unit in Region matching Condition' and use 'picked unit' instead of 'triggering unit'. Like this:
  • Killing Zombies Trigger
    • Events
      • Game - The in-game time of day becomes Equal 6.00
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (<Region where zombies are>) matching ((Unit-type of (Matching unit)) Equal Zombie)) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
Edit: You beat me Mythic! :p
 
Last edited:
Status
Not open for further replies.
Top