• 🏆 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!

Any way to set level 1 and exp to 0

Status
Not open for further replies.
Level 4
Joined
Feb 22, 2012
Messages
74
My map has abilities that "charge." The charge is determined by the hero level. When a hero uses an ability and the ability damages an enemy or heals an ally, the caster gets 1 exp point. Each level has 5 exp points and hero can go to level 6. When the hero casts his "ultimate" ability, the ultimate will have a more powerful effect based on the level and will reset hero to level 1 with 0 exp.

This works, except when the hero is level 1 and has some exp. It will not reset the exp to 0/5.

  • Events
  • Conditions
  • Actions
    • Hero - Set tempUnit0 experience to 0, Hide level-up graphics
    • Hero - Set tempUnit0 Hero-level to 1, Hide level-up graphics
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I don't think you can't go lower than the min xp required for the level.
Anyway that wouldn't be a problem here, as we are talking about the lowest level.

Try to reverse actions, maybe it will work.
Try also to play with xp bonus abilities.

Finally, try to refresh the "ui", add, remove a dummy ability to the unit.
 
Level 11
Joined
Nov 15, 2007
Messages
781
The immediate solution here would be to have all of your units start at level 2, treating level 2 as if it were level 1, and extend the max level to 7.
 
  • Custom script: call UnitStripHeroLevel(udg_Unit, GetHeroLevel(udg_Unit) - 1)
  • Custom script: call SetHeroXP(udg_Unit, 0, false)
edit
Oh wait, nevermind. Let me come up with a better solution

edit
Here:

  • Custom script: call SetHeroLevel(udg_Unit, 1, false)
  • Custom script: call AddHeroXP(udg_Unit, 5 - GetHeroXP(udg_Unit), false)
  • Custom script: call UnitStripHeroLevel(udg_Unit, 1)
 
Sorry bro, I just didn't have my World Editor available to me when I made that post.
I restarted my computer earlier and booted up with Windows, so now, I have access to my world editor again.

Here:

  • Hero - Set MyGayHero Hero-level to 1, Hide level-up graphics
  • Hero - Add (5 - (Hero experience of MyGayHero)) experience to MyGayHero, Hide level-up graphics
  • Custom script: call UnitStripHeroLevel(udg_MyGayHero, 1)
 
Status
Not open for further replies.
Top