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

How to remove all units?

Status
Not open for further replies.
Level 13
Joined
Mar 4, 2009
Messages
1,156
When unit of type "Main human" dies i need to remove all units owned by that dying unit accept one called "FED/LEAKED"

EVENT - Unit Dies
CONDITION - Unit of type dying unit equal to "Main Human"
ACTION
>>>>Remove all units owned by owner of dying unit accept unit "FED/LEAKED"

How can do that action?

And of course don't do that with abilities plz.....that could make some lags
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Set UnitGroup = All units owned by owner of dying unit
Pick all units in UnitGroup and do actions:
Unit - Remove picked unit from the game
Thx man you answerd this in 20 sec BTW

  • MAIN HUMAN DEATH
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Unit-type of (Dying unit)) Equal to Human) or ((Unit-type of (Dying unit)) Equal to Human (Female))
    • Actions
      • Set REMOVEALLUNITS = (Units owned by (Owner of (Dying unit)) matching ((Unit-type of (Matching unit)) Not equal to FEED/LEAKED))
      • Unit Group - Pick every unit in REMOVEALLUNITS and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
it all works ty:thumbs_up:
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Set UnitGroup = All units owned by owner of dying unit
Pick all units in UnitGroup and do actions:
Unit - Remove picked unit from the game
When i set "UnitGroup" at map intialization it doesent work
if i set it when unit dies it works
and if i dont set veriable but like this
  • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit)) matching ((Unit-type of (Matching unit)) Not equal to FEED/LEAKED)) and do (Actions)
    • Loop - Actions
      • Unit - Remove (Picked unit) from the game
it works too
im just cerious why it doesent work in map initalization ?
And BTW when player leaves the game his units will not be removed if there is no trigger that does that functon?
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
is is good like this? :grin:
  • MAIN HUMAN DIES
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Unit-type of (Dying unit)) Equal to Human) or ((Unit-type of (Dying unit)) Equal to Human (Female))
    • Actions
      • Set REMOVEALLUNITS = (Units owned by (Owner of (Dying unit)) matching ((Unit-type of (Matching unit)) Not equal to FEED/LEAKED))
      • Unit Group - Pick every unit in REMOVEALLUNITS and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Custom script: call DestroyGroup(udg_REMOVEALLUNITS)
      • Player Group - Make (Player group((Owner of (Dying unit)))) treat (All allies of (Owner of (Dying unit))) as an Enemy
      • Player Group - Make (All allies of (Owner of (Dying unit))) treat (Player group((Owner of (Dying unit)))) as an Enemy
      • Player Group - Make (All allies of (Owner of (Killing unit))) treat (Player group((Owner of (Dying unit)))) as an Ally with shared vision
      • Player Group - Make (Player group((Owner of (Dying unit)))) treat (All allies of (Owner of (Killing unit))) as an Ally with shared vision
      • Player - Make (Owner of (Killing unit)) treat (Owner of (Dying unit)) as an Ally with shared vision
      • Player - Make (Owner of (Dying unit)) treat (Owner of (Killing unit)) as an Ally with shared vision
      • Set FIXLAGS = (Center of VAMPIRES <gen>)
      • Unit - Create 1 MINIVAMPS[(Random integer number between 1 and 7)] for (Owner of (Dying unit)) at FIXLAGS facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_FIXLAGS)
      • Game - Display to (All players) for 30.00 seconds the text: ((Name of (Owner of (Dying unit))) + ( has been killed by + ((Name of (Owner of (Killing unit))) + and will be reborned as a vampire...)))
BTW....

Is there and easyer way to set this alliance?
I want all players that wore allied of dying unit to be enemies and all players who wore enemyes to be allied.
 
Level 11
Joined
May 31, 2008
Messages
698
Player - Make (Owner of (Killing unit)) treat (Owner of (Dying unit)) as an Ally with shared vision
Player - Make (Owner of (Dying unit)) treat (Owner of (Killing unit)) as an Ally with shared vision

Pretty sure you dont need that
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Player - Make (Owner of (Killing unit)) treat (Owner of (Dying unit)) as an Ally with shared vision
Player - Make (Owner of (Dying unit)) treat (Owner of (Killing unit)) as an Ally with shared vision

Pretty sure you dont need that

yeah i tryed without
that but it didn´t work when there is one player who is your enemy and he is owner of killing unit, i think it is becouse all ALLIES,so when killing unit doesen´t have any allies it will not work.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Your way leaks, store the unit group into a variable in you trigger, then reference it in your Unit Group action.

At the end of your trigger add

  • Custom script: call DestroyGroup(udg_YourGroupVar)

is this also leaking or ....
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • Player - Limit training of Electric Tower to 1 for (Picked player)
 
Level 8
Joined
Nov 9, 2008
Messages
502
(All players) does not leak and removing it causes problems.

There is a sticky in Triggers and Scripts board about leaks if your interested.
 
Status
Not open for further replies.
Top