So I have a system that shows a special effect whoever kills a hero first in the game and after that a different effect for subsequent kills. If the dying unit is not a hero, it will also show a different effect.
Now I want to show effects locally? Kindly help me since I dont know how to use getlocalplayer() properly without causing desync.. Thanks!
JavaScript:
function KillA takes nothing returns nothing
local unit killer = GetKillingUnitBJ()
if IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true then
set firstcount = (firstcount + 1)
if firstcount == 1 then
if GetUnitTypeId(killer) == 'Udea' then
call TriggerSleepAction(1.50)
set FBSound=CreateSound("Sound\\Responses\\Abaddon\\abad_firstblood_01.mp3",false,false,false,10,10,"HeroAcksEAX")
call SetSoundDuration(FBSound,5)
call SetSoundParamsFromLabel(FBSound,"FB")
call SetSoundVolume(FBSound,150)
call PlaySoundBJ(FBSound)
endif
if GetUnitTypeId(killer) == 'Ulic' then
call TriggerSleepAction(1.50)
set FBSound=CreateSound("Sound\\Responses\\Lich\\lich_laugh_06.mp3",false,false,false,10,10,"HeroAcksEAX")
call SetSoundDuration(FBSound,5)
call SetSoundParamsFromLabel(FBSound,"FB")
call SetSoundVolume(FBSound,150)
call PlaySoundBJ(FBSound)
endif
else
if GetUnitTypeId(killer) == 'Udea' then
call DestroyEffect(AddSpecialEffectTargetUnitBJ("origin", killer, "Sound\\Model\\Kill\\Abaddon.mdx"))
endif
if GetUnitTypeId(killer) == 'Ulic' then
call DestroyEffect(AddSpecialEffectTargetUnitBJ("origin", killer, "Sound\\Model\\Kill\\Lich.mdx"))
endif
endif
elseif IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE) == false then
set killcount[GetConvertedPlayerId(GetOwningPlayer(killer))] = (killcount[GetConvertedPlayerId(GetOwningPlayer(killer))] + 1)
if ModuloInteger(killcount[GetConvertedPlayerId(GetOwningPlayer(killer))], 2) == 0 then
if GetUnitTypeId(killer) == 'Udea' then
call DestroyEffect(AddSpecialEffectTargetUnitBJ("origin", killer, "Sound\\Model\\LastHit\\Abaddon.mdx"))
endif
if GetUnitTypeId(killer) == 'Ulic' then
call DestroyEffect(AddSpecialEffectTargetUnitBJ("origin", killer, "Sound\\Model\\LastHit\\Lich.mdx"))
endif
endif
endif
set killer = null
endfunction
function KillC takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetDyingUnit()), GetOwningPlayer(GetKillingUnitBJ())) == true
endfunction
function KillM takes nothing returns nothing
local trigger kill = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(kill, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(kill, Condition(function KillC))
call TriggerAddAction(kill, function KillA)
endfunction
Now I want to show effects locally? Kindly help me since I dont know how to use getlocalplayer() properly without causing desync.. Thanks!