ID:140378
 
Code:
mob
Monsters
icon = 'mon.dmi'
isNpc = 1

Blobble
name = "Blobble"
givExp = 8
proc
distExp(mob/M in get_step(src,src.dir))
src.exp += M.givExp
return

deathcheck(mob/M in get_step(src,src.dir))
if(M.hp <= 0 && M.isNpc)
src<<"You killed [M]"
src.distExp(M)
del(M)
if(M.hp <= 0 && M.client)
M.hp=M.mhp

return ..()


Problem description:
I don't get an error, but I won't gain EXP. I can't for the life of me figure out why, either. Help?
mob
Monsters
icon = 'mon.dmi'
isNpc = 1

Blobble
name = "Blobble"
givExp = 8
proc
distExp(mob/M)//Get rid of in get_step
src.exp += M.givExp
return

deathcheck(mob/M)//you don't need get step here either
if(M.hp <= 0 && !M.client)//you don't need a variable to see if the mob is an NPC or not
src<<"You killed [M]"
src.distExp(M)
del(M)
if(M.hp <= 0 && M.client)
M.hp=M.mhp
Your deathcheck() is backwards. It should check if M killed src, not the other way around.

Also, yeah, the "in blahblahblah" does nothing for procs.
mob
proc
distExp(mob/M)
src.exp += M.givExp
src<<"Your EXP: [src.exp]/[src.mexp]"

src.lvCheck()
return

lvCheck()
if(src.exp >= src.mexp)
src<<"Level up!"
src.lv++
src<<"Level: [lv]"
src.expFrm()
else
src<<"EXP: [round(src.exp)]"
deathcheck(mob/M)
if(M.hp <= 0 && !M.client)
src<<"You killed [M]"
src.distExp()
del(M)
if(M.hp <= 0 && M.client)
M.hp=M.mhp


mob
icon = 'b.dmi'
verb
Attack(mob/Monsters/M in get_step(usr,usr.dir))
usr<<"Name: [M.name]"
usr<<"Your damage: [round(WRdmgFrm(M))]"

usr<<"Enemy HP: [round(M.hp)]"

usr<<""
usr.distExp(usr)
M.deathcheck(M)


I can't seem to figure this problem out. I feel like it's an easy fix, so if I'm right, can someone help me out?
In response to Kirone
You aren't passing any arguments to distExp().
In response to Kirone
Kirone wrote:
mob
> proc
> distExp(mob/M)
> M.exp += src.givExp//this was backward; you had the monster giving exp to itself before it died
> M<<"Your EXP: [src.exp]/[src.mexp]"
>
> M.lvCheck()
> //return //why return if this isn't being inherited or you're not exiting the proc early or not returning a value?
>
> lvCheck()
> if(src.exp >= src.mexp)
> src<<"Level up!"
> src.lv++
> src<<"Level: [lv]"
> src.expFrm()
> else
> src<<"EXP: [round(src.exp)]"
> deathcheck(mob/M)//MIND YOUR SRC AND M, WHO GETS WHAT; THIS WAS SLOPPY
> if(src.hp <= 0 && !src.client)
> M<<"You killed [src]"
> src.distExp(M) //args 4 win
> del(src)
> if(M.client && M.hp <= 0)
> M.hp=M.mhp

mob
> icon = 'b.dmi'
> verb
> Attack(mob/Monsters/M in get_step(usr,usr.dir)) //I didn't fix anything here; does this actually work???
> usr<<"Name: [M.name]"
> usr<<"Your damage: [round(WRdmgFrm(M))]"
>
> usr<<"Enemy HP: [round(M.hp)]"
> M.deathcheck(src)//you have M as an arg before

I can't seem to figure this problem out. I feel like it's an easy fix, so if I'm right, can someone help me out?



You had your distExp() making the monster give itself exp before it kicked the bucket (well, in this version no one was getting exp since there was no args when you called the proc). Any line with a comment on it is something that's fixed.

Plus, your deathcheck() had M and src all mixed up.