- Joined
- Feb 11, 2011
- Messages
- 1,860
Hello,
I would like to know whether the following snippet would cause a desync:
It is meant to share the caster's visibility with all players when it begins casting and reset the vision back to normal if it cancels the spell or finishes it. It works fine, but I want to be sure it won't desync.
Also, would it be better to store
Thanks
Mr_Bean
I would like to know whether the following snippet would cause a desync:
JASS:
private static method checkCast takes nothing returns boolean
local player owner = GetTriggerPlayer()
if GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_CHANNEL then
if IsPlayerEnemy(GetLocalPlayer(), owner) or (IsPlayerAlly(GetLocalPlayer(), owner) and not GetPlayerAlliance(owner, GetLocalPlayer(), ALLIANCE_SHARED_VISION)) then
call UnitShareVision(GetTriggerUnit(), GetLocalPlayer(), true)
endif
elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_ENDCAST then
if IsPlayerEnemy(GetLocalPlayer(), owner) or (IsPlayerAlly(GetLocalPlayer(), owner) and not GetPlayerAlliance(owner, GetLocalPlayer(), ALLIANCE_SHARED_VISION)) then
call UnitShareVision(GetTriggerUnit(), GetLocalPlayer(), false)
endif
endif
set owner = null
return false
endmethod
It is meant to share the caster's visibility with all players when it begins casting and reset the vision back to normal if it cancels the spell or finishes it. It works fine, but I want to be sure it won't desync.
Also, would it be better to store
GetLocalPlayer()
in a local variable or not?Thanks
Mr_Bean