Setting Hero level to 1

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
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.
 

jrhetf4xb

Member
Reaction score
12
the function shown by jedi works actually like a charm.

Actually, it doesn't, or at least I can't find a reasonable cause for this script not to work:

JASS:
// Runs on unit death
    function Actions()
    {
        unit killingUnit = GetKillingUnit();
        //... bla bla bla 
            SetHeroLevel(killingUnit, 1, false);
     // etc.


It never returns the Hero's level back to 1 - it does nothing.
 

X-maul

AKA: Demtrod
Reaction score
201
I would do as mentioned above (replace) since it would probably bug the abilitys.

But if the heroes got no abilitys, you can use "Hero - Set Level"
 

jrhetf4xb

Member
Reaction score
12
Abilities are not my concern, I want to know why using "Hero - Set Level" does not work. :/
 

X-maul

AKA: Demtrod
Reaction score
201
oh, well.. I got a trigger in my map which allows you to imidiatly reach lvl 15 if its singleplayer mode, I forgot to cancel it after use and when i used it at lvl 21 it did set my hero back to lvl 15, so i cant see why it should not be possible to set it to 1 /:

sure you are sellecting the right unit?
 

Jedi

New Member
Reaction score
63
I am talking about GUI action and it works great.

JASS:
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
 

jrhetf4xb

Member
Reaction score
12
^ Oh, so the native is different... Thanks a lot, I never thought of looking inside the BJ one
 

gaskell

Member
Reaction score
0
maybe its in the event or conditions. Can you copy and paste here the trigger you are using?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top