i've never used local triggers much before but recently i have discovered that they work nicely for many triggered abilities. this particular one im working on can easily be done with 2 regular triggers but i decided to do it this way instead but not sure about leaks...and i used search and couldnt find the answer....
does it leak an 'event' from the TriggerRegisterUnitEvent function?
does it leak a 'triggercondition' from the TriggerAddCondition function?
does it leak a 'triggeraction' from the TriggerAddAction function?
Code:
function Trig_Viper_Strike_Effect_Conditions takes nothing returns boolean
return GetSpellAbilityId() == GetAbilityId_ViperStrike()
endfunction
function Trig_Viper_Strike_Effect_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local location spot = GetSpellTargetLoc()
call DestroyTrigger( GetTriggeringTrigger() )
call ShowUnit( caster, false )
call TriggerSleepAction( 0.30 )
call SetUnitPositionLoc( caster, spot )
call ShowUnitShow( caster )
call SelectUnitAddForPlayer( caster, GetOwningPlayer( caster ) )
set caster = null
call RemoveLocation( spot )
endfunction
//===========================================================================
function Trig_Viper_Strike_Actions takes nothing returns nothing
local trigger trg_Viper_Strike_Effect
local unit caster = GetSpellAbilityUnit()
local location spot = GetSpellTargetLoc()
if( IsTerrainPathable(GetLocationX(spot), GetLocationY(spot), PATHING_TYPE_WALKABILITY) ) then
set trg_Viper_Strike_Effect = CreateTrigger()
call TriggerRegisterUnitEvent( trg_Viper_Strike_Effect, caster, EVENT_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trg_Viper_Strike_Effect, Condition( function Trig_Viper_Strike_Effect_Conditions ) )
call TriggerAddAction( trg_Viper_Strike_Effect, function Trig_Viper_Strike_Effect_Actions )
else
call SpellTargetErrorMessage( "|cffffcc00Must target walkable land.|r" )
endif
set caster = null
call RemoveLocation(spot)
endfunction
function Trig_Viper_Strike_Conditions takes nothing returns boolean
return GetSpellAbilityId() == GetAbilityId_ViperStrike()
endfunction
//===========================================================================
function InitTrig_Viper_Strike takes nothing returns nothing
set gg_trg_Viper_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Viper_Strike, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Viper_Strike, Condition( function Trig_Viper_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Viper_Strike, function Trig_Viper_Strike_Actions )
endfunction
does it leak an 'event' from the TriggerRegisterUnitEvent function?
does it leak a 'triggercondition' from the TriggerAddCondition function?
does it leak a 'triggeraction' from the TriggerAddAction function?