ID:145241
 
Code:
    Attack(mob/M as mob in oview(1))
var/damage = usr.str - M.def
usr<<"You attack [M] for [damage] damage!"
oview()<<"[usr] attacks [M] for [damage] damage!"
M.HP -= damage
M.Death()

mob/proc
Death()
if(src.type == /mob/player)
PlayerDie()
else
if(src.HP <= 0)
range() << "[src] has been killed by [usr]!"
src.overlays -= 'characters.dmi'
usr.Exp += 5
del(src)

PlayerDie()
if (src.HP <= 0)
view() << "[src] has been killed"
src.loc = locate(7,5,1)
src.HP = src.MAXHP
src.MP = src.MAXHP

mob
proc
Check(mob/player)
if(src.Exp>=usr.NExp)
src.LevelUp()


mob/proc

LevelUp(mob/player)
if(src.class=="Skeleton")
if(src.Exp>=src.NExp)
src.Level += 1
src.MAXHP += rand(2,5) * src.Level
src.MAXMP += rand (4,10) * src.Level
src.str += rand (2,4) * src.Level
src.def += rand (2,7) * src.Level
src.NExp += src.Level * 35
src.HP = src.MAXHP

if(src.class=="Pigmonster")
if(src.Exp>=src.NExp)
src.Level +=1
src.MAXHP += rand(5,10) * src.Level
src.MAXMP += 0
src.str += rand (5,10) * src.Level
src.def += rand (3,8) * src.Level
src.NExp += src.Level * 45
src.HP = src.MAXHP

if(src.class=="Slime")
if(src.Exp>=src.NExp)
src.Level +=1
src.MAXHP += rand(3,7) * src.Level
src.MAXMP += rand(3,7) * src.Level
src.str += rand (3,7) * src.Level
src.def += rand (3,7) *src.Level
src.NExp += src.Level * 15
src.HP = src.MAXHP


Problem description: The attaking is working fine, and so is the the death for monster, even the experiance going to the player is fine! But the Exp just goes over the needed and the player does not level up! Please help.

No put usr in proc. Ungh.
You are not calling the levelup() proc after giving the EXP. Also, that Check() proc is useless, since you check for the EXP everytime you call levelup(). Just add the levelup() after usr.Exp += 5.
In response to Pyro_dragons
Pyro_dragons wrote:
You are not calling the levelup() proc after giving the EXP. Also, that Check() proc is useless, since you check for the EXP everytime you call levelup(). Just add the levelup() after usr.Exp += 5.


I did before I posted, and then it says that I did not define the LevelUp proc
In response to Jp
Jp wrote:
No put usr in proc. Ungh.

where did I put usr?
I made sure I didnt have it, only when I needed it to give Exp is it in a proc
In response to FriesOfDoom
You don't need it in any proc. Use arguments. You've got it in mob/Death().
In response to Jp
Jp wrote:
You don't need it in any proc. Use arguments. You've got it in mob/Death().


where the hell is a noob suppose to find a unmiss leading tutorial!
In response to FriesOfDoom
where the hell is a noob suppose to find a unmiss leading tutorial!

Umm..... What?