- Joined
- Jan 2, 2016
- Messages
- 472
JASS:
function Trig_HeroLearnAbilities_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer playerID = GetPlayerId(GetOwningPlayer(u))
local integer whichAbi
local integer learnedAbi = GetLearnedSkill()
local integer curLevel = GetUnitAbilityLevel(u, learnedAbi)
local integer loadAbiId
if learnedAbi == 'A004' then
set whichAbi = 0
elseif learnedAbi == 'A005' then
set whichAbi = 1
elseif learnedAbi == 'A006' then
set whichAbi = 2
elseif learnedAbi == 'A003' then
set whichAbi = 3
endif
set loadAbiId = LoadInteger(udg_HeroAbilities, playerID, whichAbi)
call UnitAddAbility(u, loadAbiId)
//call SetUnitAbilityLevel(u, loadAbiId, curLevel)
set u = null
endfunction
The action is called by the
EVENT_PLAYER_HERO_SKILL
.What's wrong ? Well the
UnitAddAbility(...)
returns false for reasons unknown.Printing the unit's name and the ability's name ( loadAbiId ) works fine.I may have missed something simple though. If you need more information about this please tell me.