#job levelsystem

1 messages · Page 1 of 1 (latest)

fleet ridge
#

I'm currently in the process of creating a job system with a level function. I wanted to ask how you could make the XP that is left over when you level up be added to the next level. So, for example, if you have 995/1000 XP and you get 10 XP for breaking a block means you basically have 105 XP. These 5 XP should then be carried over to the next level.

swift night
#

Compute the difference between the current experience and the amount of experience needed to level up. If it's greater than the amount of experience received, subtract the previously calculated difference from it and you get what you want.

#
{_diff} > {_experienceToBeAdded}
set {_leftOverExperience} to {_experienceToBeAdded} - {_diff}```
#

I think the code explains it well.

lyric gorge
#

instead of setting the XP to 0 or deleting it, just remove the required level-up amount from it

fleet ridge
#

So the current xp - the neededxp?

swift night