• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Replacing hero with another hero of different level.

Status
Not open for further replies.
Level 13
Joined
Nov 4, 2006
Messages
1,239
you can use the "remove unit from game" action when a hero reaches level 11 to completely remove a hero from the game and then just create a new one. there is is also a "replace" action, however i do not know if this has any negative impact if you use it to replace heroes of different levels, maybe just play around with the triggers a little to find out.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
You can't reduce the hero level.
You can... Tested just now with the following GUI trigger...
  • Melee Initialization
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • Hero - Set Blood Mage 0000 <gen> Hero-level to (Integer((Entered chat string))), Hide level-up graphics
This uses the following JASS to do the level change.
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
    endif
endfunction
It will even unlearn abilities that have already been learned as appropriate, at least for melee situations.
You can probably use chaos to turn your hero into a unit, and then remove it to turn it back into a hero, this MIGHT reset the hero level, but I wouldn't advise this because it'll do other dumb shit like turn your bonus armor into base armor (which is extremely undesirable if there are any +armor effects, auras, etc).
It is also extremely crash prone. Why not just set the hero to a lower level using a trigger?
 
Level 8
Joined
Feb 11, 2016
Messages
232
There is no way to replace hero "A" of level 11 for hero "B" of 1. But! You can remove Hero "A" from the game and create hero "B" basically he comes with 0 exp, now I only need way to give him items carried by hero "A", how to do that?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
how to do that?
If one just wants to change the unit types then use inverse morph trick. Set the base form of copied Bear form ability to his new hero form. Add then immediately remove this ability and the hero's unit type is changed. All stats should be retained from the old hero including level and learnt abilities. All non-permanent abilities are lost. One can lower the hero level back to 1 using triggers, as I described above.

If one wants to change the base hero properties or learnable abilities then there is no direct way. As others suggested one has to make a new unit with the new hero type and copy across what is appropriate for it. One also has to move all group and variable references to this new unit. One would need to track tome usage and re-apply as appropriate if your map uses them.

One can move hero items across by forcing the old hero to drop all the items before it is removed, and then placing these items on the new hero unit. One can use a for loop to iterate through the various item slot numbers.
 
Level 8
Joined
Feb 11, 2016
Messages
232
I found a way. Easy and nice one. I mean we found it. I really don't know how I miss this.

Important:
- "Best Trainer level 2. (BTn1S)" is name of ability I using in this trigger;
- Don't need "Wait" action to work properly.
- "Beast Trainer (BTn2)" is name of hero "B" (Hero "A" transmute into hero "B").

Hope this helps you.
Promena junaka..png
 
Level 8
Joined
Feb 11, 2016
Messages
232
Ye', also I forgot to add in my trigger hero "B" have equally percent hp and mana as a hero "A". Now it's done, so simply, so easy. Enjoy :D.

P.S: Also I changed my wait time just because I want 60, you can put any value.

Promena junaka..png
 
Status
Not open for further replies.
Top