ID:179564
 
I have this "attack" spell that's works well, except it's having trouble killing the monster.

mob/proc/Blast1(mob/M as mob) //removed most of the animation code...
if(usr.mp>=5)
var/damage=10*usr.level
M.hp -= damage
usr.mp-=5
npcdeathcheck(M)
else
usr<<"<B>You don't have enough MP !</B>"


mob/proc
npcdeathcheck(mob/P as mob, mob/M as mob)
if (M.hp <= 0)
P << "You have killed the [M]!"
P.exp += M.expreward
endbattle(P)
del (M)
else
npcattack1(P, M)


Now, after casting the spell, it's shows some errors such as:
runtime error: Cannot read null.hp.
proc name: npcdeathcheck

Any ideas ?
THX.
Make sure the NPC has HP.
Make sure you provide both arguments for your death checker.
Like this:

npcdeathcheck(usr,M)


That should fix it.
In response to Cinnom
It works now.
Thx for your help.

(If this is considered a waste of post i'll delete it...)