• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] Is there a way to...

Status
Not open for further replies.
You can make it with GetLocalPlayer(). Note that it will cause desyncs if you, for instance, try to do
  • Actions
    • Custom script: if GetLocalPlayer() then
    • Unit - Hide Your_Unit
    • Custom script: endif
and it will desync.

However, if you want to disable the visibility completely for other players you could do:
  • Actions
    • Custom script: if GetLocalPlayer() then
    • Animation - Change Your_Unit's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
    • Custom script: endif
The last one will not create desyncs, but will also disable allowance for the other players to see, manually attack, select etc the affected unit.
 
Oh my bad, I simply forgot. You should actually do:
  • Custom script: if GetLocalPlayer() != udg_YourPlayerVariable then
Yeah the local player respond to the player on the pc. So, with the expression above, all players except the variable player would be affected and not able to see the unit.
 
Hey it does not work -.-
JASS:
function ShowUnitForPlayer takes player p, unit u returns nothing
    if GetLocalPlayer() != p then
        call ShowUnit(u,true)
    endif
    set p = null
    set u = null
endfunction

function HideUnitForPlayer takes player p, unit u returns nothing
    if GetLocalPlayer() != p then
        call ShowUnit(u,false)
    endif
    set p = null
    set u = null
endfunction

  • Invisible
    • Events
      • Player - Player 1 (Red) types a chat message containing - as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 1)) Equal to -
    • Actions
      • Set String = (Integer((Substring((Entered chat string), 2, 3))))
      • Custom script: call HideUnitForPlayer(Player(udg_String),udg_selected)
      • Wait 1.00 seconds
      • Custom script: call ShowUnitForPlayer(Player(udg_String),udg_selected)
when i type in lets say -2 or -7 or sum it still hides for me -.-
 
Last edited:
Well... As I said... You cannot do that, since it will cause desyncs. As it goes for the code, its probably something about th substring which screws it up.
Also, do not null parameters. Wc3 do that automatically.

Well, this works:
JASS:
function ShowUnitForPlayer takes player p, unit u returns nothing
    if GetLocalPlayer() != p then
        call ShowUnit(u,true)
    endif
endfunction
function HideUnitForPlayer takes player p, unit u returns nothing
    if GetLocalPlayer() != p then
        call ShowUnit(u,false)
    endif
endfunction
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as An exact match
    • Conditions
    • Actions
      • Set unit = Gnoll Assassin 0002 <gen>
      • Custom script: call HideUnitForPlayer(Player(PLAYER_NEUTRAL_PASSIVE), udg_unit)
  • Untitled Trigger 001 Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing unhide as An exact match
    • Conditions
    • Actions
      • Set unit = Gnoll Assassin 0002 <gen>
      • Custom script: call ShowUnitForPlayer(Player(PLAYER_NEUTRAL_PASSIVE), udg_unit)
 
Status
Not open for further replies.
Back
Top