[Solved] How to hide destructibles to a single player

Not open for further replies.
Level 23
Jan 1, 2011
[Solved] How to hide destructibles to a single player

I've started this thread to ask how I could hide a destructible to a single player but have it show for all the other players. I've been searching around and all I could find was a line of custom script I could not understand.
call ShowDestructable(d, GetLocalPlayer() == p)
If someone could create a map with this done in as much GUI as possible, it would be greatly appreciated.
Last edited:
For simplicity in GUI, you can just do this:
  • Actions
    • Set TempPlayer = Player 1 (Red)
    • Custom script: if GetLocalPlayer() == udg_TempPlayer then
    • Destructible - Show/Hide <Your Destructible>
    • Custom script: endif
It is a bit more easy to modify to your needs.

Change "Player 1 (Red)" to whoever you want to show/hide the destructible for. Then just change the destructible action to "Show" or "Hide", depending on what you want to do for "TempPlayer". Change the "<Your Destructible>" part to whatever destructible you want to show/hide.

If you want to change the variable name of TempPlayer, make sure that you change "TempPlayer" in the custom script part as well.

While the above actions works without causing desyncs, you run the risk of desyncs if anyone interacts with the destructible. For example, if one of the players who can see the destructible attacks it or selects it, there will most likely be a desync.



Level 40
Jan 7, 2005
Just as a side note, I believe you can hide the destructibles for only a single player as long as the hidden destructibles are not interacted with. In the same way that you could probably have different times of day for different players as long as there were no units regenerating health during the night or Moon Well abilities.

P.S. — I'm not a JASS expert, but I think GetLocalPlayer()==p is a boolexpr (boolean expression) and not an actual boolean, so it probably won't work the way you intend it to do.

Dr Super Good

Spell Reviewer
Level 63
Jan 18, 2005
GetLocalPlayer()==p compares the returned value from GetLocalPlayer native with a variable in the namespace of p for equalty.

GetLocalPlayer() returns the player the client controls. As such the value is not syncrnious and unique for each client. As only currently active human players have a client, its scope of values is limited to just that. Due to its asyncrnious nature, using tests on the value can get a unique boolean which can be used with conditional flow control to run code on only certain clients.

When using the native, it is important to remember that it is unique per client, and thus if used in flow control it will run code only for certain clients. Anything that will cause a client to no longer have the same session state as all other clients (like creating a unit locally) will result in an out of sync "split".
Not open for further replies.