constant unitevent EVENT_UNIT_HERO_SKILL=ConvertUnitEvent(79)
constant playerunitevent EVENT_PLAYER_HERO_SKILL=ConvertPlayerUnitEvent(42)
constant native GetLearnedSkill takes nothing returns integer
constant native GetLearnedSkillLevel takes nothing returns integer
native GetUnitAbilityLevel takes unit whichUnit, integer abilcode returns integer
function Trig takes nothing returns nothing
local integer level = GetLearnedSkillLevel()
if (level == 1) then
//level 1 actions
elseif (level == 2) then
//level 2 actions
else
//all other levels actions
endif
endfunction
function TrigConds takes nothing returns boolean
return (GetLearnedSkill() == 'ABCD')
endfunction
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(t, Condition(function TrigConds))
call TriggerAddAction(t, function Trig)
set t = null
endfunction
function Trig takes nothing returns nothing
local integer level = GetUnitAbilityLevel(GetSpellAbilityUnit(), 'ABCD')
if (level == 1) then
//level 1 actions
elseif (level == 2) then
//level 2 actions
else
//all other levels actions
endif
endfunction
function TrigConds takes nothing returns boolean
return (GetSpellAbilityId() == 'ABCD')
endfunction
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function TrigConds))
call TriggerAddAction(t, function Trig)
set t = null
endfunction
function ActionsOf1 takes nothing returns nothing
//level 1 actions
endfunction
function ActionsOf2 takes nothing returns nothing
//level 2 actions
endfunction
function ActionsOf3 takes nothing returns nothing
//level 3 actions
endfunction
function Trig takes nothing returns nothing
local integer level = GetUnitAbilityLevel(GetSpellAbilityUnit(), 'ABCD')
call TriggerExecute(CODES[level])
endfunction
function TrigConds takes nothing returns boolean
return (GetSpellAbilityId() == 'ABCD')
endfunction
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function TrigConds))
call TriggerAddAction(t, function Trig)
set t = CreateTrigger()
set CODES[1] = t
call TriggerAddAction(t, function ActionsOf1)
set t = CreateTrigger()
set CODES[2] = t
call TriggerAddAction(t, function ActionsOf2)
set t = CreateTrigger()
set CODES[3] = t
call TriggerAddAction(t, function ActionsOf3)
set t = null
endfunction
CODES