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

[Trigger] Player Leaves the game

Status
Not open for further replies.
Level 12
Joined
Mar 30, 2013
Messages
664
Hi!
TD releated]

When im playing online and a players leave the game and he got for an example 5 towers remaining in the map. And when he have leaved the Towers stands there and keep attacking like it does normaly. So my question is that if some one knows how to remove the tower(s) when the player have leaved?
 
Something along the lines of:
  • Leave Game
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • ... continue adding events for other players ...
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering Player)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit)
If you only want to remove certain units, then you would select "Units owned by (Triggering Player) matching <some condition>". The bj_wantDestroyGroup line is just to prevent a leak from the group created by "Units owned by (Triggering player)".
 
Level 12
Joined
Mar 30, 2013
Messages
664
Ok thank you! It worked fine tested it in bnet, tok some time before a player leaved =P
But a question more. Do you know how to turn of a trigger when the player leaves?
Because i got spawn that is spawning units and if the players leavs it will keep spawning. Got any triggers tips to turn it off when player(s) leaves?
 
Status
Not open for further replies.
Top