Local variables only exist for as long as the scope they're declared in does. Every time your trigger fires, it initializes "TeamColors" as a new Ally Color Setting with the default value. Because of this, it's always "Normal Colors" at the time you check its value, so your trigger will always set the triggering player's ally color setting to "Team Colors for Minimap and Game View".
One solution is to instead keep track of each player's setting using a global Ally Color Setting array which is indexed by player. Assuming you use the same variable name for the global, the correct trigger would look similar to this:
EventsUI-PlayerAnyPlayerpressesFkeyDownwithshiftExclude,controlExclude,altRequireLocalVariablesplayer=(Triggeringplayer)<Integer>ConditionsActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfTeamColors[player] == Normal Colors
Then
Variable - Set TeamColors[player] = Team Colors for Minimap and Game View
UI - Lock ally color settings for players in (Player group(player)) to TeamColors[player]
Else
Variable - Set TeamColors[player] = Normal Colors
UI - Lock ally color settings for players in (Player group(player)) to TeamColors[player]
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Local variables only exist for as long as the scope they're declared in does. Every time your trigger fires, it initializes "TeamColors" as a new Ally Color Setting with the default value. Because of this, it's always "Normal Colors" at the time you check its value, so your trigger will always set the triggering player's ally color setting to "Team Colors for Minimap and Game View".
One solution is to instead keep track of each player's setting using a global Ally Color Setting array which is indexed by player. Assuming you use the same variable name for the global, the correct trigger would look similar to this: