• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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
539
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