ID:265002
 
Code:
mob/proc
DeathCheck(mob/M)
if(src.HP<=0)
if(src.client)
M<<output("<font color=red><I>You have killed [src.fname] [src.lname]","chat")
src<<output("<font color=red><I>You have been killed by [M.fname] [M.lname]","chat")
src.loc=locate(1,1,1)
src.HP=src.MaxHP
src.MP=src.MaxMP
else
M<<output("<font color=red><I>You have killed the [src.fname] [src.lname]!","chat")
src.loc=locate(58,143,8)
src.HP=src.MaxHP
src.MP=src.MaxMP
sleep(300)
src.loc=initial(loc)


Problem description:
No message is sent to M,this has been troubling me for weeks,but i can't find out why.
mob/proc
DeathCheck(mob/M)
world << "M : [M]"


Add that world output line at the beginning and see what it ouputs, then paste that here so we can troubleshoot. It could be that you're not really passing a mob.
In response to ANiChowy
ANiChowy wrote:
> mob/proc
> DeathCheck(mob/M)
> world << "M : [M]"
>

Add that world output line at the beginning and see what it ouputs, then paste that here so we can troubleshoot. It could be that you're not really passing a mob.

I've already done that half a dozen times,M apparently doesn't exist.
In response to Flare SilverBend
Try something like
M = usr

right above every if statement and such.
In response to Raimo
That fixed the error for the deathcheck partially,but when I use a projectile,it sends the message to the projectile.

mob/verb
Firebolt()
set category="Spells"
if(usr.wand==0)goto Nowand
if(usr.MP<10)return
if(src.delay)
return
usr.Magical_Potential-=1
usr.MEXP+=1
MLevelcheck()
src.MP-=10
src.delay=1
spawn(6)
src.delay=0
new/mob/Firebolt(src)
return
Nowand
usr<<output("<font color=red>You need a wand to cast this!","chat")


mob/proc
hit(mob/M)
if(M.def==999999)del(src)
if(isobj(M))del(src)
if(isturf(M))del(src)
push_away(M)
M.HP -= src.damage
M.DeathCheck(usr)
sleep(1)
del(src)
In response to Flare SilverBend
is it because you have src in the projectile bump? try owner, or make a var called owner.
In response to BeignetLover
BeignetLover wrote:
is it because you have src in the projectile bump? try owner, or make a var called owner.

Do you mean this code?



mob/proc
hit(mob/M)
if(M.def==999999)del(src)
if(isobj(M))del(src)
if(isturf(M))del(src)
push_away(M)
M.HP -= src.damage
M.DeathCheck(usr)
sleep(1)
del(src)


For my bump proc,I use atom/M
In response to Flare SilverBend
This is a pretty simple error. Just make sure that every time you're calling deathcheck() you are passing the appropriate mob to it instead of any old reference.