I am currently working on my first map (still) and learning as I go. I've run into a problem, I wish to destroy all units/buildings owned by a person who has left or if someone was never there in the first place.
For instance: game is a 3v3, but the host began as 1v1. I want to remove the units/buildings of the 4 unused players. Can anyone help?
Check their status at map initialization. If they are not user controlled and playing then pick all units owned by them allowing everything and then remove the units. Run this test for all players in an integer loop.
In another trigger with a player leaves event you do the same actions for the triggering player.
Clean Empty Slots
Events
Game - Map initialization
Local Variables
Conditions
Actions
Player Group - Pick each player in (All players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Or
Conditions
(Status of player (Picked player)) == Unused
(Status of player (Picked player)) == Left The Game
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Picked player) matching (No Value), with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
Clean Dropper
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 (No Value), with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Clean Empty Slots
Events
Game - Map initialization
Local Variables
Conditions
Actions
Player Group - Pick each player in (All players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Or
Conditions
(Status of player (Picked player)) == Unused
(Status of player (Picked player)) == Left The Game
Then
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Picked player) matching (No Value), with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Else
Clean Dropper
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 (No Value), with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game
Thank you so much! I didn't realize the check was a conditional.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello everyone!
I am currently working on my first map (still) and learning as I go. I've run into a problem, I wish to destroy all units/buildings owned by a person who has left or if someone was never there in the first place.
For instance: game is a 3v3, but the host began as 1v1. I want to remove the units/buildings of the 4 unused players. Can anyone help?
Thanks!
Check their status at map initialization. If they are not user controlled and playing then pick all units owned by them allowing everything and then remove the units. Run this test for all players in an integer loop.
In another trigger with a player leaves event you do the same actions for the triggering player.
How do I check players in map initalization?
Considering your question, if you want to go further, you will have to learn how triggers work.
I can't join a map here ? I took time to build these triggers -.-
Here are some examples...
So we can't join a map or a zip any more ?