ID:263807
 
Code:
/mob/verb
Attack(mob/M as mob|mob in oview(1))
set category = "Actions"
set popup_menu = 0
usr.exp += damage
view(2) << "<font color=white>[usr] attacks [M]"
damage= usr.str + 10 -M.def
M.hp-=damage
M.deathcheck()
usr.levelup()


mob
proc
levelup()
if(usr.exp>=usr.next)
usr << "<font color=green>Level up!"
usr.level+=1
usr.str+=3
usr.def+=2
usr.exp=0
usr.next*=1.2
else
//world << "Doesn't Level" // Debug Message
return


Problem description:
Ok so I have the proc for levelup() and I try to play and when it reaches 300 exp or max hp it dosent level and it just continues to add to the exp.

Just putting it out there you have usr where you should have src,
        usr.exp += damage
view(2) << "<font color=white>[usr] attacks [M]"
damage= usr.str + 10 -M.def
M.hp-=damage

shouldn't that not work at all. where have you defined damage.
In response to Tubutas
yea ok I did that and changed it to src but IT STILL WONT LEVEL UP!
In response to Swift_falcon240
Post where you define damage and next.
damage should be declared within that verb, not as mob/var/damage. Then, add exp only AFTER damage is calculated.

You also need to change every instance of usr in the levelup() proc to src.

Make sure that the next variable is 300.

Also, you probably need to change deathcheck() to accept an argument, because I bet you're using usr in that as well, which is also wrong.
In response to Tubutas
/mob/verb
Attack(mob/M as mob|mob in oview(1))
set category = "Actions"
set popup_menu = 0
damage= src.str + 10 -M.def
usr.exp += damage
view(2) << "<font color=white>[usr] attacks [M]"
M.hp-=damage
M.deathcheck()
usr.levelup()

mob
proc
levelup()
if(usr.exp>=usr.next)
usr << "<font color=green>Level up!"
usr.level+=1
usr.str+=3
usr.def+=2
usr.exp=0
usr.next*=1.2
else
return
atom/movable
var
damage
Money = 3000
Banned = 0
talked = 0
hp = 300
maxhp = 300
level = 1
str=10
def=10
speed=1

mob
var
exp = 0
next = 300
Clan
Muted = 0
GM
FontColor = "#FF0000"
NameColor = "#00FF00"
In response to Swift_falcon240
Ok I fixed some stuff


/mob/verb
Attack(mob/M as mob|mob in oview(1))
set category = "Actions"
set popup_menu = 0
var/damage
damage= src.str + 10 -M.def
usr.exp += damage
view(2) << "<font color=white>[usr] attacks [M]"
M.hp-=damage
M.deathcheck()
usr.levelup()


mob
proc
levelup()
if(src.exp>=src.next)
src << "<font color=green>Level up!"
src.level+=1
src.str+=3
src.def+=2
src.exp=0
src.next*=1.2
else
//world << "Doesn't Level" // Debug Message
return




mob
proc
deathcheck(mob/M)
if(src.hp<=0)
src << "<font color=red>You have fainted"
src.hp=usr.maxhp
src.z=1
src.x=8
src.y=12
world << "<font color=red>[M] has fainted!"
else
return
In response to Swift_falcon240
You've still got usr in deathcheck. Aside from that, however, what you have SHOULD work.

Oh, "mob|mob" is silly. Just change that to "mob".
In response to Garthor
ok... It still dosent work...
In response to Swift_falcon240
nvm! I found the error! my punching bag had a type mismatch
In response to Swift_falcon240
Runtimes are a bitch. Make sure to kill any that come up, else os they occur too often they can not only make things not work correctly, but they can crash your game.