- Joined
- Jun 30, 2008
- Messages
- 580
Hello Hivers,
So I have a question about GetLocalPlayer(), I noticed in a system like this:
The GetLocalPlayer() doesn't cause a desync, but when I use it here it causes a desync:
So I have a question about GetLocalPlayer(), I noticed in a system like this:
JASS:
private function bPeriodic takes nothing returns nothing
local integer p = GetPlayerId(GetLocalPlayer())
// Applies BattleCam
if bUnit != null then
if TimerGetRemaining(StartPan) <= PAN_DURATION then
call ApplyBattleCam(p, PAN_DURATION)
else
call ApplyBattleCam(p, TimerGetRemaining(StartPan))
endif
endif
set p = p+1
The GetLocalPlayer() doesn't cause a desync, but when I use it here it causes a desync:
JASS:
private function DistanceCheck takes nothing returns nothing
local CharData cData = LoadInteger(CharacterHash, GetPlayerId(GetLocalPlayer()), 1)
local unit u
if cData.uData.Target != null then
// Sets Selection Dummy to Target
call SetUnitPosition(DummyUnits[i], GetUnitX(cData.uData.Target), GetUnitY(cData.uData.Target))
// Removes Target if out of Target Range
if Distance(cData.uData.Unit, cData.uData.Target) >= MAX_TARGET_DISTANCE and cData.uData.Target != null then
call RemoveUnit(DummyUnits[i])
set u = cData.uData.Target
set cData.uData.Target = null
call cData.mHUD.removeBlock(u, 4)
endif
// If out of combat zone sets to false and enables ThirdPersonCam
if Distance(cData.uData.Unit, cData.uData.Target) > MAX_COMBAT_DISTANCE and cData.uData.InCombat != false then
call EnableBattleCam(Player(i), null, null, 0)
call EnableThirdPersonCam(Player(i), cData.uData.Unit, 2)
set cData.uData.InCombat = false
endif
// Enables BattleCam if in distance of selected target
if Distance(cData.uData.Unit, cData.uData.Target) <= MAX_COMBAT_DISTANCE and cData.uData.InCombat == false then
set cData.uData.InCombat = true
call EnableThirdPersonCam(Player(i), null, 0.0)
call EnableBattleCam(Player(i), cData.uData.Unit, cData.uData.Target, 2.0)
endif
endif
endfunction