Welcome to mapster! I don't have access to the editor right now but there should be a trigger event like "Player leaves." In that trigger make an action Pick Each unit in Unit Group. This is a loop. For the unit group choose all units in region matching condition, and for that chose entire map and owned by player "Triggering Player" (which is a function).
In that loop, pick the action "Remove unit." For the unit, chose "Picked Unit" (which is a function).
My trigger didnt work. Here is my trigger code. What goes wrong?
Events
Player - Player Any Player leaves the game with Any
Local Variables
Conditions
Actions
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
1. this may sound stupid, but just make sure that the action "Unit - Remove (picked unit) from the game) is inside your "Pick each unit" loop, and not accidentally outside.
2. maybe try "unit - kill (picked unit)" and see if it works.
3. is there a trigger error being shown when a player leaves the game? if so, what is it?
If all this fails, my best guess is that the trigger is working properly, but its just that technically the player doesn't have any units (meaning the units the player controls belong to another player)
the player leaves event only fires if the player loses, wins, or ties the game. It doesnt detect disconnects, alt-f4's, or menu->quits
you need a periodic timer or something, then use a pick each player in 'all players'.. if player status = left the game (or w/e), then do:
kill all units owned by player.
I find way how make this work. Thanks to all for help. Here is trigger code.
Events
Timer - Every 1.0 seconds of Game Time
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 1) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 2) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 2 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 3) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 3 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 4) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 4 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 5) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 5 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 6) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 6 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 7) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 7 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 8) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 8 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
I make game where is minigames like Raynor Party. I want trigger, when next minigame start. Leavers players units dont appear minigame.
@PaskaTykki: Go
Welcome to mapster! I don't have access to the editor right now but there should be a trigger event like "Player leaves." In that trigger make an action Pick Each unit in Unit Group. This is a loop. For the unit group choose all units in region matching condition, and for that chose entire map and owned by player "Triggering Player" (which is a function).
In that loop, pick the action "Remove unit." For the unit, chose "Picked Unit" (which is a function).
Hope that helps!
Some relevant wiki articles:
http://www.sc2mapster.com/wiki/galaxy/triggers/category-events/#w-galaxy-triggers-events-player-leaves-game-player-leaves
http://www.sc2mapster.com/wiki/galaxy/triggers/pick-each-unit-in-unit-group/ http://www.sc2mapster.com/wiki/galaxy/triggers/in-region-matching-condition/ http://www.sc2mapster.com/wiki/galaxy/triggers/remove-unit/
My trigger didnt work. Here is my trigger code. What goes wrong?
Events
Player - Player Any Player leaves the game with Any
Local Variables
Conditions
Actions
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
@PaskaTykki: Go
Your trigger looks fine to me...hm.
1. this may sound stupid, but just make sure that the action "Unit - Remove (picked unit) from the game) is inside your "Pick each unit" loop, and not accidentally outside.
2. maybe try "unit - kill (picked unit)" and see if it works.
3. is there a trigger error being shown when a player leaves the game? if so, what is it?
If all this fails, my best guess is that the trigger is working properly, but its just that technically the player doesn't have any units (meaning the units the player controls belong to another player)
the player leaves event only fires if the player loses, wins, or ties the game. It doesnt detect disconnects, alt-f4's, or menu->quits
you need a periodic timer or something, then use a pick each player in 'all players'.. if player status = left the game (or w/e), then do:
kill all units owned by player.
@iE4TM4PS: Go
Can you give that trigger code? It is easier find.
I find way how make this work. Thanks to all for help. Here is trigger code.
Events
Timer - Every 1.0 seconds of Game Time
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 1) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If (Status of player 2) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 2 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 3) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 3 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 4) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 4 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 5) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 5 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 6) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 6 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 7) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 7 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player 8) == Unused
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 8 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
Ok for future reference do something like this.
Event - EVery 1 second
Pick each integer between 1 and 8. and do actions
Actions:
If Status of Picked Integer == (notplaying ) or unused
Then Pick each unit owned by player picked integer blah blah blah
actions unit remove (picked unit) from the game
Else
-
@CrazyTwigman: Go
Ok. Thanks to hint. :)