I need some help with some triggers. I have tried some solutions, but I can't get it to work.
Here is what I want it to do:
It is a 4 player map, but if there is only two players playing it, then I want the starter units for player 3 and 4 to be removed.
Also, when a player leaves in the middle of the game, I want to give the control of the leaving player to the other players on the team.
Also, when a player leaves in the middle of the game, I want to give the control of the leaving player to the other players on the team.
I think It's done automatically, when player leaves, his resources are spread between remaining allies, and his units become available for shared control.
There are some errors in your code that you should know about.
By default, for event to run successfully, all conditions must return true, which means that for this to run player 1 must be both "unused" and "left the game". Can unused player leave the game? I think "Left The Game" is unneeded.
Next, when you "pick" anything, be it unit or player, the correct parameter to use is "picked unit"/"picked player".
"Triggering anything" means something that triggered event, and nothing else.
You didn't pick any player, so "Picked player" in condition is not what you think it is.
And again, you need "Picked Unit" instead of "Triggering Unit".
Also, player/unit groups by default contain nothing. You first fill them with stuff, then work with it. "Player Group[4]" is not a size of player group, its an array of 4 different independent player groups.
Btw, Nerfpl is right about how you should do it. Feel free to ask more questions or post code for us to point out your misunderstandings.
Hi there!
I need some help with some triggers. I have tried some solutions, but I can't get it to work.
Here is what I want it to do: It is a 4 player map, but if there is only two players playing it, then I want the starter units for player 3 and 4 to be removed. Also, when a player leaves in the middle of the game, I want to give the control of the leaving player to the other players on the team.
I have tried:
and
and another one I found here at SC2Mapster, but with no success.. Thanks for all help! :)
For players you check amount of active players (Number of players in (Active Players))
to detect which are not present you can do
For leaving try
Ok, I couldn't find how to check the amount of active players..
Some more information would be nice :) Thanks.
Player group > Number of players in Player group
Player group > Player in Player group
This is what I came up with: "Maxplayers" is a variable (Integer) with size 4. "Player Group" is type Player Group with size 4.
Still... No luck :/
I think It's done automatically, when player leaves, his resources are spread between remaining allies, and his units become available for shared control.
There are some errors in your code that you should know about.
By default, for event to run successfully, all conditions must return true, which means that for this to run player 1 must be both "unused" and "left the game". Can unused player leave the game? I think "Left The Game" is unneeded.
Next, when you "pick" anything, be it unit or player, the correct parameter to use is "picked unit"/"picked player". "Triggering anything" means something that triggered event, and nothing else.
You didn't pick any player, so "Picked player" in condition is not what you think it is.
And again, you need "Picked Unit" instead of "Triggering Unit".
Also, player/unit groups by default contain nothing. You first fill them with stuff, then work with it. "Player Group[4]" is not a size of player group, its an array of 4 different independent player groups.
Btw, Nerfpl is right about how you should do it. Feel free to ask more questions or post code for us to point out your misunderstandings.
Hehe, it wasn't worse? :)
I only had to change the (Triggering Unit to Picked Unit) as you explained DuckyTheDuck. Thank you so much! :)
And many thanks to you Nerfpl as well for guiding me trough the correct steps!
Now I only need to test with my friends the trigger "leaves the game", but I will get to that when my map is completed ;)
Thanks again <3