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

Remove "units from region X" from the game?

Status
Not open for further replies.
Level 4
Joined
Aug 26, 2015
Messages
71
I can't find the way to do that. I've tried to use: Unit - Remove but it can only remove a certain unit, and unit group - remove only removes an unit group. How can i remove units on a X region from the game?
 
Level 11
Joined
Jun 2, 2013
Messages
613
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set YourGroup = (Units in RegionX <gen>)
      • Unit Group - Pick every unit in YourGroup and do (Unit - Remove (Picked unit) from the game)
      • Custom script: call DestroyGroup(udg_YourGroup)
To clarify,

YourGroup is a UnitGroup Variable.
You then set that UnitGroup variable to 'Units in a RegionX'.
Use the Unit Group action to pick every unit in YourGroup (the Variable you just set) and then remove picked unit from the game.
Since you set YourGroup to units in RegionX, it will remove any unit in RegionX from the game.
Then you use the custom script to destroy the group to clear the memory leak.

Easy Peasy ;)
 
Status
Not open for further replies.
Top