ID:1116140
 
(See the best response by Jemai1.)
Code:
mob
proc
levelup()
if(src.exp >= src.max_exp)
src.exp = 0
usr.max_str +=50
usr.max_exp +=1000
usr.max_energy +=10
usr.max_hp +=100
usr.max_def +=50
usr.hp_regen +=150
usr.hp=usr.max_hp
usr.energy=user.max_energy
usr.level += 1
usr.cp += 2
usr.sp += 1
usr.age += 1
usr.gold+=usr.level*500
usr.BasicSkillGain()
usr.Save()


Problem description:

The code shown above is the leveling proc for a new project(Been working on it for awhile, but haven't announced it... so, yes... new) and while it does not show any errors while being compiled... the actual procedure does not take place in game. I have tested the game on two different computers, and it still will not allow any players to level up.

I have no idea where the problem lies, or if I just did something incorrectly... so, suggestions and/or advice would be greatly appreciated! Onegai!(Please.w.)

Thanks for reading, and I hope someone will be able to guide me through this frustrating issue.
-Zan3
Best response
No usr in procs.

You'll also want to loop that since there is an instance where a player can level up more than once.
levelup()
var/save = FALSE
while(exp >= max_exp)
exp -= map_exp
save = TRUE
// other stuff here
if(save)
// save outside the loop
I think this would be nice:

mob
proc
levelup()
if(src.exp >= src.max_exp)
src.exp -= src.max_exp
src.max_str +=50
src.max_exp +=1000
src.max_energy +=10
src.max_hp +=100
src.max_def +=50
src.hp_regen +=150
src.hp=usr.max_hp
src.energy=user.max_energy
src.level += 1
src.cp += 2
src.sp += 1
src.age += 1
src.gold+=usr.level*500
src.BasicSkillGain()
src.levelup()
src.Save()
In response to Eternal_Memories
There are still usr and "user" on the right side. Plus, you'll want to put exp >= max_exp in a while. Basically, everything I said in the previous post.
mob/proc/levelup()
if(exp>=max_exp)
exp=0
level++
max_exp+=1000
src<<"You have leveled up"
max_str+=50
BasicSkillGain()
Save()
return



I don't think src or usr is needed. Unless the proc is for multiple mobs.



I think the proc is correct it must be that the player is not getting exp or that you're not calling level_up() right.