Im using pointValue (pv) diffrent for each hero-type.
Then set your abilities to variables, I call them Skill1, Skill2 etc.. integer array:
JASS:
set udg_Skill1[pv] = 'Amls'
set udg_Skill2[pv] = 'Ainf'
set udg_Skill3[pv] = 'something'
set udg_Skill4[pv] = 'something'
here you have trigger I use for learn abilities for AI:
JASS:
function Trig_SPHeroLevelUp_Conditions takes nothing returns boolean
local integer i= GetPlayerId(GetOwningPlayer(GetLevelingUnit()))
if GetPlayerController(Player(i))==MAP_CONTROL_COMPUTER then
call SelectHeroSkill(udg_Hero[i+1], udg_Skill4[GetUnitPointValue(udg_Hero[i+1])])
call SelectHeroSkill(udg_Hero[i+1], udg_Skill1[GetUnitPointValue(udg_Hero[i+1])])
call SelectHeroSkill(udg_Hero[i+1], udg_Skill2[GetUnitPointValue(udg_Hero[i+1])])
call SelectHeroSkill(udg_Hero[i+1], udg_Skill3[GetUnitPointValue(udg_Hero[i+1])])
endif
return false
endfunction
//===========================================================================
function InitTrig_SPHeroLevelUp takes nothing returns nothing
set gg_trg_SPHeroLevelUp = CreateTrigger( )
call DisableTrigger( gg_trg_SPHeroLevelUp )
call TriggerRegisterAnyUnitEventBJ( gg_trg_SPHeroLevelUp, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddCondition( gg_trg_SPHeroLevelUp, Condition( function Trig_SPHeroLevelUp_Conditions ) )
endfunction
dont worry with those "i+1" cause I switch from gui and was to lazy to edit all map for these integers
zibi