The following code is an example, it is not the actual code used in the game.
mob
var
experience
maxexperience
level
proc
Level_Up()
if(src.exp>=src.maxexp)
src.level+=1
src.maxexperience+=src.level*200
src.experience=0
Lets say your max experience is 100 and your experience is 95, and you gain 20 experience. This character will level up, but the extra fifteen experience points are lost.
I have a feeling that it will involve some kind of math, which, unfortunately, is not my strong subject.
Can somebody give or show me a good way to do this? Feel free to add on to the example code I have provided you. Or you can just explain how it would work.
Thanks very much,
-JaiZo