library Example initializer ExampleInit
globals
// Put your global variables here, if any
endglobals
function ExampleOnCast takes nothing returns nothing
// This function runs whenever a unit starts the effect of an ability (see ExampleInit)
local unit u = GetTriggerUnit()
call SetWidgetLife(u, 999999)
set u = null
endfunction
function ExampleInit takes nothing returns nothing
// This function runs automatically thanks to the library initializer
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t, function ExampleOnCast)
set t = null
endfunction
endlibrary