To run a piece of code only for one player, you filter out the players that you don't want to see it:
(Don't copy triggers yet.)
-
Custom script: set udg_TempPlayer = GetLocalPlayer()
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-

If - Conditions
-


Or - Any (Conditions) are true
-



Conditions
-




TempPlayer Equal to Player 1 (Red)
-

Then - Actions
-


-------- runs for selected players --------
-

Else - Actions
-


-------- do nothing -------- (is a comment)
First, you set the "TempPlayer" variable to the local player.
So every player who is playing now has a different value in that variable.
If the value is equal to "Player 1 (Red)" (which only happens for player 1), then the "Then" block runs.
For all other players, the "Else" block runs but you ussually dont use it.
In any case, there are some restrictions to what you can do for one player only.
You cannot for example create/remove units, destructables, items, locations, groups, texttags, etc, etc, etc... you cannot create/remove anything at all.
You can also not change any gameplay related things, like adding an ability to a unit, changing a unit's location, damaging a unit, etc.
In your case, you want to hide a unit for all players except one or two.
In that case, you create the unit before the If/Then/Else block and hide it inside the If/Then/Else block:
-
Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees (Leaks location, I know.)
-
Set TempUnit = (Last created unit)
-
Custom script: set udg_TempPlayer = GetLocalPlayer()
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-

If - Conditions
-


Or - Any (Conditions) are true
-



Conditions
-




TempPlayer Equal to Player 1 (Red)
-

Then - Actions
-


-------- runs for selected players --------
-

Else - Actions
-


-------- do nothing --------
-


Unit - Hide TempUnit
-


Animation - Change TempUnit's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
Now there are two ways to hide a unit,
1, Hide the unit.
2, Make the unit invisible (color wise).
I am not quite sure if option 1 is allowed locally, so you may just use the animation action and remove the unit - hide action from the trigger.
Ofcourse, you check if "TempPlayer" is equal to the owner or the target.
There is one slight problem... you want to store 3 players:
1, The owner of the unit.
2, The targeted player.
3, The local player.
Instead of making 3 "TempPlayer", "TempPlayer1", "TempPlayer2" variables, we change our "TempPlayer" variable to an array.
Now you have 8191 "TempPlayer[<number>]" variables all in one.
So "TempPlayer[0]" is the owner.
"TempPlayer[1]" is the target.
And "TempPlayer[2]" is the local player.
(Ofcourse we also do this for the unit variable.)
-
Actions
-

Set TempPlayer[0] = Player 1 (Red)
-

Set TempPlayer[1] = Player 2 (Blue)
-

-------- - --------
-

Unit - Create 1 Footman for TempPlayer[0] at (Center of (Playable map area)) facing Default building facing degrees (Still leaks, I still know.)
-

Set TempUnit[0] = (Last created unit)
-

-------- - --------
-

Custom script: set udg_TempPlayer[2] = GetLocalPlayer()
-

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-


If - Conditions
-



Or - Any (Conditions) are true
-




Conditions
-





TempPlayer[2] Equal to TempPlayer[0]
-





TempPlayer[2] Equal to TempPlayer[1]
-


Then - Actions
-



-------- runs for selected players --------
-



-------- unit is already visible --------
-


Else - Actions
-



-------- do nothing --------
-



Unit - Hide TempUnit[0] <<< So dont use this
-



Animation - Change TempUnit[0]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency