mob/var
LVL = 1 //level
EXP = 0 //"min exp"
EXPN=100//"exp needed"
GEXP = 0//exp that monster gives
gain = 0//enables monsters to give exp
ob/proc
Death() //what happens when something "dies"
if(HP<=0) //hp must be below zero to "die"
view() << "[src] is destroyed by [usr]."
if(gold>=1) // makes it so gold is only dropped if they have it
usr.gold += src.gold
usr << "You get [gold] gold from [src]!"
if(src.gain==1) //if mob gives exp...
src.EXP += src.GEXP
usr << "You gain [GEXP] experience points!"
usr.Levelup()
del src
mob/proc
Levelup()
if(usr.EXP<=usr.EXPN)
src<<"You have reached the next level!"
src.LVL++
src.EXP=(src.EXP-EXPN)//problem is here
src.EXPN=src.EXPN*1.6
else
return
Problem description:
Okay the problem is that my code keeps miscalculating how to reset the Player's experience. If I would take out the problem line of code it automatically sets the player's experience back to zero, which I don't understand where I told it to do that (although it's a nice sentiment). I've been trying to get it so that the player's experience will "overlap" into their next level.
For example. Bob gains 100 EXP and reaches the next level so his experience after he levels up should be 0 (100EXP-100EXPN). Nick gains 105 experience and reaches the next level, his experience should now be 5 (105EXP-100EXPN).