function Trig_One_Conditions takes nothing returns boolean
return GetLearnedSkillBJ() == 'A000' //Replace 'A000' with the rawcode of your ability; press Ctrl + D to view your ability names into rawcodes.
endfunction
function Attacks takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer id = GetHandleId (t)
local integer i = LoadInteger (udg_Hashtable, id, StringHash("number"))
local unit u = GetAttacker()
local unit u1
local unit u2 = GetTriggerUnit()
if i == 0 then
set u1 = LoadUnitHandle (udg_Hashtable, id, StringHash("caster"))
if u == u1 then
call UnitDamageTarget (u, u2, 50, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
call SaveInteger (udg_Hashtable, id, StringHash("number"), 4)
else
call SaveInteger (udg_Hashtable, id, StringHash("number"), i - 1)
endif
set u = null
set u1 = null
set u2 = null
endfunction
function Trig_One_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local trigger t = CreateTrigger()
local integer id = GetHandleId (t)
local integer i = 4 //Number of attacks
call TriggerRegisterAnyUnitEventBJ (t, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction (t, function Attacks)
call SaveInteger (udg_Hashtable, id, StringHash("number"), i)
call SaveUnitHandle (udg_Hashtable, id, StringHash("caster"), u)
set u = null
endfunction
//===========================================================================
function InitTrig_One takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( t, Condition( function Trig_One_Conditions ) )
call TriggerAddAction( t, function Trig_One_Actions )
endfunction