ID:141453
 
Codes Involved:
mob
proc
DeathCheck()
if(usr.Health <= 0)
usr.loc = locate(/turf/Checkpoints/DeathLand)
usr<<"You have been killed"
else
return



obj/Guns
Pistol
icon = 'icons.dmi'
icon_state = "Gun"
verb
Shoot()
set src in usr.contents
var/obj/c= new/obj/bullet(usr.loc)
c.dir=usr.dir
walk(c,c.dir,1) //makes it go alittle fast
Get()
set src in oview(1)
src.Move(usr)
usr<<"You have the [src]!"
Drop()
set src in usr.contents
src.Move(usr.loc)


obj/bullet
density = 1
icon = 'icons.dmi'
icon_state = "bullet"
Bump(q)
if(ismob(q))
var/mob/target=q
target.Health-=rand(20,40)// youa re using the health variable
target.DeathCheck()
target<<"You get hit by a [src]"
del src


Problem description:

I keep getting this runtime error:
runtime error: Cannot read 0.Health
proc name: DeathCheck (/mob/proc/DeathCheck)
usr: 0
src: Shop (/mob/Shop)
call stack:
Shop (/mob/Shop): DeathCheck()
the bullet (/obj/bullet): Bump(Shop (/mob/Shop))
and no matter how many times I shoot the pistol at it, it doesnt die, even if its health is below 0. Please help

q doesn't have a type, I think would be your problem.

Bump(atom/A)
if(ismob(A))
//...
del src //I put it here because it should delete itself whenever it bumps into anything, rather than just mobs
In response to Spunky_Girl
I believe that is not his problem ... i guess it's because he used 'usr' instead of 'src' in the DeathCheck() proc ...