Yes there are memory leaks.
There is also a coding problem.
Use this:
Code:
function Trig_Backtrack_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(), 'B03S')>0
endfunction
function Backtrack_Main takes nothing returns nothing
local unit lfo=GetTriggerUnit()
local real lf7=GetEventDamage()
if(lf7>0)then
if(GetRandomInt(1,100)<=(10+(15*GetUnitAbilityLevel(lfo,'A0KP'))))then
call SetWidgetLife(lfo,GetWidgetLife(lfo)+lf7)
endif
endif
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function Trig_Backtrack_Actions takes nothing returns nothing
local trigger ltt=CreateTrigger()
if GetUnitAbilityLevel(GetTriggerUnit(),'A0KP')>=1 then
call TriggerRegisterUnitEvent(ltt,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call TriggerAddAction(ltt,function Backtrack_Main)
else
call DestroyTrigger(ltt)
endif
set ltt=null
endfunction
By the looks of this, when a unit is attacked, it has a chance to negate the damage received.
Only a few flaws:
If the negated damage is greater than your max HP, you'll die (Even if it was "blocked").
If you negate damage but your HP is full, you will take the damage.