HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Simple question - will this script cause dysnc

02-24-2008, 01:08 AM#1
inkken
Does the ShowUnit() function cause net traffic (server splits)?
I plan on using as so:

Collapse JASS:
function test takes integer a returns nothing
local unit u = CreateUnit( Player(15), 'uabo', 0, 0, 0)
//call SetAltMinimapIcon("Blah.blp")
//call UnitSetUsesAltIcon( u, true)
call ShowUnit(u, false)

if GetLocalPlayer() == Player(a) then
call ShowUnit( u, true)
endif

endfunction

The unit is for aesthetic purposes only; no combat value - it will just sit there.
02-24-2008, 01:17 AM#2
Ammorth
If its for aesthetic purposes, I would use SetUnitVertexColor and give it 0% opacity. I know for sure this is friendly to use and will not desync while I cannot guarantee showunit will not.
02-24-2008, 01:20 AM#3
inkken
Whoops, sorry for the poor explanation on the aesthetic purposes. I need the unit to be hidden so its special alternative icon will not show up. I want this for my mini-map icon filter system.

An other alternative i have is to use the call UnitSetUsesAltIcon() function... but... i don't even know if its safe or not.

Doesn't the blood seeker, in DotA, 3rd skill use some kind of localized show/hide unit function?
02-24-2008, 04:29 AM#4
inkken
I went ahead and tested it. For future reference, ShowUnit() used with getlocalplayer causes dysnc?

Collapse JASS:
globals
    trigger array tra
    triggeraction array taa
endglobals

function Test takes nothing returns nothing
local unit u = CreateUnit( Player(15), 'uaco', 0, 0, 0)
local boolean b = false
local integer c = 0
local integer a = 0

call ShowUnit(u, false) 

loop
    exitwhen false
    
    call TriggerSleepAction( 0.23)
    call DisplayTextToForce( GetPlayersAll(), "Executing show/hide unit")
    set c = GetRandomInt( 0, 3)
    
    if GetLocalPlayer() == Player(c) then
        set a = GetRandomInt( 0, 1)
    
        if a == 1 then
            set b = true
        else
            set b = false
        endif
    
        call ShowUnit( u, b)
           
    endif
    
endloop
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set tra[0] = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( tra[0], Player(0) )
    call TriggerAddAction( tra[0], function Test )
endfunction

Anyone want to point out any miss-usage in the script above?