Would making a function like this be the best way or is there another better way?
Code:
function randomskill takes integer rawcode returns integer
local integer ran = GetRandomInt(1,5)
if rawcode == 'hpal' then
if ran == 1 then
return 'AUav'
elseif ran == 2 then
return 'ANms'
elseif ran == 3 then
return 'AOsh'
elseif ran == 4 then
return 'AHbh'
elseif ran == 5 then
return 0
endif
endif
return 0
endfunction
Code:
function Trig_LearnSkill_Actions takes nothing returns nothing
call SelectHeroSkill( GetLevelingUnit(), randomskill(GetUnitTypeId(GetLevelingUnit())))
endfunction
//===========================================================================
function InitTrig_LearnSkill takes nothing returns nothing
set gg_trg_LearnSkill = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_LearnSkill, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddAction( gg_trg_LearnSkill, function Trig_LearnSkill_Actions )
endfunction