jrhetf4xb
Member
- Reaction score
- 12
How can I return a Hero's level back to 1?
I don't think you can do so because the abilities will be screwed up.
Remove the previous hero and create a new hero instead.
the function shown by jedi works actually like a charm.
// Runs on unit death
function Actions()
{
unit killingUnit = GetKillingUnit();
//... bla bla bla
SetHeroLevel(killingUnit, 1, false);
// etc.
function SetHeroLevelBJ takes unit whichHero, integer newLevel, boolean showEyeCandy returns nothing
local integer oldLevel = GetHeroLevel(whichHero)
if (newLevel > oldLevel) then
call SetHeroLevel(whichHero, newLevel, showEyeCandy)
elseif (newLevel < oldLevel) then
call UnitStripHeroLevel(whichHero, oldLevel - newLevel)
else
// No change in level - ignore the request.
endif
endfunction