ID:142947
 
Code:
obj
var/mob/owner //This var will reference the owner
waterproj
icon='proj.dmi'
icon_state="water"
density = 1
Bump(mob/M)
if(istype(M,/mob))
if(!owner) del src //Deletes itself if there is no owner to avoid runtimes
var/damage=round(owner.maxreiatsu/10)
M.health-=damage
view(6)<<"[M] takes [damage] damage."
M.KOcheck()
mob
verb
Mizu_Houkou()
usr.projectile(new/obj/waterproj(usr.loc),usr.dir,20)


mob
proc
projectile(obj/projectile,var/dir,var/delay)
projectile.owner = src //Sets the mob as the owner of the projectile
sleep(1)
walk(projectile,dir)
sleep(delay)
del(projectile)


Problem description:

So I shoot this bad boy at one of my NPCs, and I get this:

runtime error: Cannot read null.health
proc name: KOcheck (/mob/proc/KOcheck)
usr: 0
src: Shinigami Guard (Level 10) (/mob/Shiniguard/shiniguard1)
call stack:
Shinigami Guard (Level 10) (/mob/Shiniguard/shiniguard1): KOcheck(null)
the waterproj (/obj/waterproj): Bump(Shinigami Guard (Level 10) (/mob/Shiniguard/shiniguard1))



So here's my KOcheck

mob/var/KOed = 0
mob/proc
KOcheck(mob/M)
if(M.health<=0)
M.canmove=0
M.KOed=1
view(6)<<"[M] has been knocked out."
if(M.NPC==0)
sleep(60)
M.canmove=1
M.KOed=0
var/half = M.maxhealth/2
M.health = half
Remove the argument to KOCheck() and replace all the Ms with src.

Also: change view(6) to view(6,src).