function GA_Actions takes nothing returns nothing
local integer chance
local integer level = GetUnitAbilityLevel(udg_DamageEventSource, 'A000')
local unit dummy
call BJDebugMsg("1")
if level > 0 then
call BJDebugMsg("2")
if level == 1 then
set chance = 60
elseif level == 2 then
set chance = 10
elseif level == 3 then
set chance = 8
elseif level == 4 then
set chance = 5
endif
if GetRandomInt(1, 100) <= chance then
set dummy = CreateUnit(GetOwningPlayer(udg_DamageEventSource), 'u000', GetUnitX(udg_DamageEventSource), GetUnitY(udg_DamageEventSource), 0)
call UnitAddAbility(dummy, 'A001')
call IssueTargetOrder(dummy, "drunkenhaze", udg_DamageEventSource)
call UnitApplyTimedLife(dummy, 'BTLF', 1)
endif
set dummy = null
endif
endfunction
// For this, just create the trigger, name it "GA" and place all the script inside
function InitTrig_GA takes nothing returns nothing
local trigger GA = CreateTrigger()
call TriggerRegisterVariableEvent(GA, "udg_DamageEvent", EQUAL, 1.00)
call TriggerAddAction(GA, function GA_Actions)
set GA = null
endfunction