- Joined
- Feb 2, 2006
- Messages
- 1,596
Hi,
is it possible to replace hero abilities via code without replacing the unit type.
I do not want to use two unit types since I would like the player to freely select any hero abilities he wants to.
Somewhere in a forum somebody posted that you can remove hero abilities by skilling them to the maximum level and then removing them.
Something like:
I am not sure it really works.
Is it even possible to replace the hero ability? Are there some maps out there which allow you to freely choose your hero abilities?
In my map I register all hero abilities per unit type, so I know which abilities a hero has by default, to remove them.
Is there an easier way to get the hero abilities without prestoring them in some way?
is it possible to replace hero abilities via code without replacing the unit type.
I do not want to use two unit types since I would like the player to freely select any hero abilities he wants to.
Somewhere in a forum somebody posted that you can remove hero abilities by skilling them to the maximum level and then removing them.
Something like:
JASS:
function RemoveHeroAbility takes unit hero, integer abilityId returns nothing
local integer skillPoints = GetHeroSkillPoints(hero)
local integer additionalSkillPoints = 100 - GetUnitAbilityLevel(hero, abilityId)
local integer i
call HeroAddSkillPoints(hero, additionalSkillPoints)
set i = 0
loop
exitwhen (i == additionalSkillPoints)
call LearnHeroSkill(hero, abilityId)
set i = i + 1
endloop
call UnitRemoveAbility(hero, abilityId)
call SetHeroSkillPoints(hero, additionalSkillPoints)
endfunction
I am not sure it really works.
Is it even possible to replace the hero ability? Are there some maps out there which allow you to freely choose your hero abilities?
In my map I register all hero abilities per unit type, so I know which abilities a hero has by default, to remove them.
Is there an easier way to get the hero abilities without prestoring them in some way?