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!
How do you detect a hero's exp to its next level? Like, 0/10 for example. 0 is its current exp,and 10 is the exp needed for it to level up. Thanks in advance.
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.
No, I cannot show you triggers.
But the theory is pretty simple.
1, create hero.
2, loop from 1 to 10 (maximum level of heroes)
- increase hero level
- store current exp of hero in array with index A (from the loop)
3, remove the hero from the game.
Then you have the required exp per level in an array.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.