• 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.

How to detect a hero's exp to next level?

Status
Not open for further replies.
Level 24
Joined
Aug 1, 2013
Messages
4,658
There is a cheap way to do it.
Which is creating a dummy hero and leveling it up via triggers.
Then each time, you check how much EXP he has.
Then you store that in an array, and then you can read from that array how much it was.

The "proper" way is to implement the formula of required exp into the game.
That way, you can do it without the need of dummies nor anything else.
 
Level 11
Joined
Jun 2, 2004
Messages
849
The dummy unit one does have the advantage of only having 1 place where the xp curve is defined. If you want to change it later, you only need to modify gameplay constants, instead of having to modify your initialization trigger as well. Duplicated data is a big cause of unnecessary bugs, as people forget to update every place something is defined.
 
Status
Not open for further replies.
Top