HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Single Player Actions, LocalPlayer, and Desyncs

09-24-2007, 04:06 AM#1
StRoNgFoE_2000
Collapse JASS:
function SelectUnitForPlayerSingle takes unit whichUnit, player whichPlayer returns nothing
    if (GetLocalPlayer() == whichPlayer) then
        // Use only local code (no net traffic) within this block to avoid desyncs.
        call ClearSelection()
        call SelectUnit(whichUnit, true)
    endif
endfunction
function PanCameraToTimedForPlayer takes player whichPlayer, real x, real y, real duration returns nothing
    if (GetLocalPlayer() == whichPlayer) then
        // Use only local code (no net traffic) within this block to avoid desyncs.
        call PanCameraToTimed(x, y, duration)
    endif
endfunction

I'm not too knowledgeable on this GetLocalPlayer() and desyncs. Are using these blizzard functions the only way I can actually select a unit or pan a camera for a single player? I'll just keep using these functions if there is any chance of alternatives causing desyncs or whatever I'm trying to talk about.
09-24-2007, 04:33 AM#2
Pyrogasm
You must use a LocalPlayer If block, so these functions are your best option.