I just learned this the hard way, and I think this knowledge may benefit other mapmakers.
Normally, when you assign a variable to another variable, you're just making the assigned-to variable equal to the assigned-from variable. But when your variables are player groups, assigning one to the other actually links them both together.
If you want to mess with a copy of a player group without modifying the original, you have to assign using the function "Copy of Player Group" or whatever it is.
Example: I had a (global) player group named Marines that contained all "Marine" players. But I also have some ranks among them, such as Lieutenant, Sergeant, Corporal, and Grunts. I wanted to assign an Objective to every Marine except for the Lieutenant, so I created a local variable, named "Everyone But Lieutenant" and of type Player Group. I assigned the Marines variable to it. I then removed Lieutenant from "Everyone But Lieutenant".
Later, in a completely different trigger, I started having trouble with setting alliances for the Marines group. Every Marine would be affected by the change except for the Lieutenant.
I eventually stumbled back upon the above local variable, and I tried assigning it as a copy of the Marines player group instead of assigning it to be equal to the player group.
This fixed the problem.
In short, when one variable was assigned to the other, modifying one player group modified the other as well. In order to modify a temporary copy, you have to make a copy of it rather than simply assign it.
And that's the sort of thing you only figure out after hours of headache, huh. Also took me a little testing to find out that the order in which players are added to a player group doesn't matter. The lowest player number is always 1st player in that group, next lowest is 2nd, etc.
I just learned this the hard way, and I think this knowledge may benefit other mapmakers.
Normally, when you assign a variable to another variable, you're just making the assigned-to variable equal to the assigned-from variable. But when your variables are player groups, assigning one to the other actually links them both together.
If you want to mess with a copy of a player group without modifying the original, you have to assign using the function "Copy of Player Group" or whatever it is.
Example: I had a (global) player group named Marines that contained all "Marine" players. But I also have some ranks among them, such as Lieutenant, Sergeant, Corporal, and Grunts. I wanted to assign an Objective to every Marine except for the Lieutenant, so I created a local variable, named "Everyone But Lieutenant" and of type Player Group. I assigned the Marines variable to it. I then removed Lieutenant from "Everyone But Lieutenant".
Later, in a completely different trigger, I started having trouble with setting alliances for the Marines group. Every Marine would be affected by the change except for the Lieutenant.
I eventually stumbled back upon the above local variable, and I tried assigning it as a copy of the Marines player group instead of assigning it to be equal to the player group.
This fixed the problem.
In short, when one variable was assigned to the other, modifying one player group modified the other as well. In order to modify a temporary copy, you have to make a copy of it rather than simply assign it.
Hope this information helps someone!
And that's the sort of thing you only figure out after hours of headache, huh. Also took me a little testing to find out that the order in which players are added to a player group doesn't matter. The lowest player number is always 1st player in that group, next lowest is 2nd, etc.
Huh, I did not know those things about player groups.
It also took me a long time to figure out that unit groups are the same. Hopefully this saves headaches for others if they read it.