ID:167388
 
ok, my leveling script doesnt work, and I have no idea why.
    Level_gain()
if (usr.slashing * 25 <= usr.atksxp)
usr.atksxp = 0
usr.slashing += 1
usr << "Your Slashing skill is now [usr.slashing]"
if (usr.bashing * 25 <= usr.atkbxp)
usr.atkbxp = 0
usr.bashing += 1
usr << "Your Bashing skill is now [usr.bashing]"
if (usr.missle * 25 <= usr.atkmxp)
usr.atkmxp = 0
usr.missle += 1
usr << "Your Missle skill is now [usr.missle]"
if (usr.xp >= usr.lvl*50)
usr.lvl ++
usr.xp = 0
usr.mstam += rand(usr.lvl, usr.lvl+3)
usr.mhp += rand(usr.lvl, usr.lvl+3)
usr.mmp += rand(usr.lvl, usr.lvl+3)
usr << "You are now level [usr.lvl]"


ignore the no usr in procs rule, this proc is ONLY called when someone uses the attack verb, and therefore, will always be a usr. that, and src wasnt cutting it for the first 3/4ths of the proc.
What's the problem?
Well, what's it doing that it shouldn't?
In response to ArcaneVirus
The only reason src doesn't work is because you messed it up somewhere. Again, no wonder what you say, never use usr in procs.
In response to Mysame
(switched all the usr's to src)
ok, it isnt doing the stuff after the
if (src.xp >= src.tnl)

even I know that the src.xp is greater than the src.tnl(i have it set up to show the xp and tnl)
In response to Albire
How and where do you call the proc?
In response to Mysame
when the usr uses the attack() verb, i'll post it:

mob
verb
//other verbs
Attack(mob/MON/M as mob in oview(1))
set src in oview(1)
var
damage = rand(usr.mindam, usr.maxdam)
damage1
usr.tnl = usr.lvl*5
if (usr.noa == 0)
if(usr.stam >= 1)
usr.stam -= 1
if (usr.wbatk == "Slashing")
M.hp -= damage + usr.slashing
damage1 = damage + usr.slashing
usr.atksxp += damage
if (usr.wbatk == "Bashing")
M.hp -= damage + usr.bashing
usr.atkbxp += damage
damage1 = damage + usr.bashing
if (usr.wbatk == "Missle")
M.hp -= damage + usr.missle
usr.atkmxp += damage
damage1 = damage + usr.missle
usr << "you do [damage1] damage to the [M]!"
usr.xp += damage1
death_check(M)
Level_gain()
usr.noa = 1
sleep(usr.aspd)
usr.noa = 0
else
usr << "You are too low on stamina!"
else
usr << "You are attacking too fast"


everything seems to go well in this verb, the xp is gained and everything. the leveling script just going up with the xp like it should