mob
var/exp = 0
proc/GainExp(E)
if(exp < 10)
view() << "[src] gaind exp!"
usr.GainExp(5)
var/lv = 0
proc/Lv_Up(L)
if(usr.exp >= Maxexp)
lv ++
var/Maxexp = 10
proc/MaxGainE(Mex)
Maxexp = Maxexp + Mex
usr.MaxGainE(10)
Problem description:
I cant figure out why it wont lv when it hits max exp and know it wont record exp at all I should also mention that constantly sends the message saying I gained exp I made a death proc to see how it would record to the usr it works fine but every thing I throw at this doesn't work I've been at this for days and finally decided to ask for help!
The usr variable is a special variable that is handled contextually, so it isn't a reliable reference for the object that the procs are running on.
You should be using src because it is always 100% the object that the proc is running on (unless you manually set the src variable to something else, which you should never do anyway).
If you actually replace usr with src, you'll end up creating infinite loops because of your calls to GainExp() inside GainExp(), and MaxGainE() in MaxGainE(), which is called recursion. I'm not sure why those lines are even there.