[Solved] GetLocalPlayer() for Special Effects

NEL

NEL

Level 6
Joined
Mar 6, 2017
Messages
113
I want to make a Hero Selection which if you clicked the hero, it will add Arrow effect on hero's overhead attachment. When a player selected other hero, the arrow effect will be destroyed.

The problem is the desync.

This is my code that I doing right now.
JASS:
        set udg_HS_thisUnit[ID] = thisUnit
        if( udg_HS_sfx[ID] != null ) then
            call DestroyEffect( udg_HS_sfx[ID] )
        endif
      
        if( GetLocalPlayer() == pl ) then
            set udg_HS_sfx[ID] = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Aneu\\AneuTarget.mdl", thisUnit, "overhead" )
        endif

How to fix this? It is possible?
 
Last edited:

LeP

LeP

Level 11
Joined
Feb 13, 2008
Messages
516
The standard way is this:
JASS:
local string sfx = "Abilities\\Spells\\Other\\Aneu\\AneuTarget.mdl"
if GetLocalPlayer() != pl then
    set sfx = ""
endif
call AddSpecialEffect(sfx, x, y)
This way the effect is created for all players but only visible for your specific player
 
Top