• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

*Help* Setting Exp or Exp Level

Status
Not open for further replies.
Level 3
Joined
Jan 10, 2010
Messages
29
Is there a command, or line of code that allows you to set the exp of a unit to a given value, so as to allow a unit to retain exp after death? If so where can I find this.
 
Level 8
Joined
May 31, 2009
Messages
439
When you revive a unit, it automatically retains it's current XP. Otherwise, it can be easily fixable by determining how much XP it has before it dies, and then giving it back once it revives. (This shouldn't be the case)

The line is a custom value, and you have to make your dying unit a variable. Here's an example:

  • Revive
    • Events
      • Unit - Any Unit dies
    • Local Variables
      • DieingHero = No Unit <Unit>
    • Conditions
      • ((Unit type of (Triggering unit)) is Hero) == true
    • Actions
      • Variable - Set DieingHero = (Triggering unit)
      • General - Wait 20.0 Real Time seconds
      • General - Custom Script: UnitRevive (lv_dieingHero);
      • Unit - Set DieingHero Life (Percent) to 75.0
      • Unit - Set DieingHero Energy (Percent) to 75.0
      • Unit Selection - Select DieingHero for player Owner of Dieing Hero
General - Custom Script: UnitRevive (lv_dieingHero);

Is the important line in the trigger. "lv_" represents a Local Variable and the dieingHero is the name of your variable.

This should retain level, XP and abilities. To the last of my knowledge it still doesn't keep the items :(.

Hope this helped.
 
Level 3
Joined
Jan 10, 2010
Messages
29
Thanks, your help exceeds expectations. My original problem involved not being able to find how to revive units, instead I was having to re-create them then add all the exp back. Hopefully your command should solve that problem entirely.

Edit:
Revive Trigger is not working :( Firstly It allocated all the units to team 16 so it was impossible to determine whether it was respawning or not. Following this (After map was closed then re-opened) It allocated the units to the right team, but failed to revive them. And yet the trigger worked fine on another map???
 
Last edited:
Status
Not open for further replies.
Top