- Joined
- Mar 29, 2012
- Messages
- 542
I used this on my spell to set variables related with ability levels, so I want to share with you cuz I'm still unsure too about things like: is it okay to use this (create a unit) on map initialization? What's the best unit type to use? And is this effective?
JASS:
function GetAbilityMaxLevels takes integer abilCode returns integer
local integer result
local unit dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'Naka', 0, 0, 0)
call UnitAddAbility(dummy, abilCode)
call SetUnitAbilityLevel(dummy, abilCode, 100)
set result = GetUnitAbilityLevel(dummy, abilCode)
call RemoveUnit(dummy)
set dummy = null
return result
endfunction