• 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.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

[Solved] GetLocalPlayer() for Special Effects

Status
Not open for further replies.

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 13
Joined
Feb 13, 2008
Messages
544
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
 
Status
Not open for further replies.
Top