ID:139802
 
Code:
//Part of the Deathcheck Proc, quit long, cut it down to parts that will help.
mob/proc/deathcheck(mob/M)
if(src.level<=50&&src.client&&M.health<=10)
src<<"You cannot kill [M], you are under level 50."
M.health = 10
return 0
if(M.health<=0&&!M.dead)//173


//Poison cloud...the Poison proc is called from here.
obj/PoisonCloud
layer=MOB_LAYER+3
icon = 'PBall.dmi'
icon_state = "cloud"
New()
..()
Start
for(var/mob/M in src.loc)
var/mob/O = src.owner
if(!M.poisoned)
if(!M.Kawarimi_Teleport())
M.poisoned=1
spawn(0) M.Poison(O)
spawn(5)
goto Start
spawn(100)
del(src)

//the Poison proc its self.
mob/proc
Poison(mob/M)
Start
if(src.Clan=="Human Puppet")
src.poisoned = 0
src.strongpoisoned=0
src.sasoripoisoned=0
if(src.poisoned==1)
if(!src.inimmortal)
src.health -= 50
if(src.incircle)
if(src.someoneinhidanlist)
for(var/mob/U in world)
if(src.hidanlist == U.name)
if(!U.inimmortal)
U.health-=50
src.deathcheck(U)
if(src.health<=0)
src.poisoned=0
src.deathcheck(M)
else
sleep(5)
goto Start


Problem description:

This problem will probly be something small that I have overlooked ._. I just have this feeling...ANYWAYS, the main problem is that after I poison a mob (putting the Poisoned var to 1 and calling the Poison Proc) their Health drains fine, but when their Health would hit 0, the Deathcheck proc is someone getting a null...


here is the actual runtime error that it is giving me.

runtime error: Cannot read null.health
proc name: deathcheck (/mob/proc/deathcheck)
source file: DeathCheck.dm,173
usr: 0
src: Enemy (NPC) (/mob/Enemy)
call stack:
Enemy (NPC) (/mob/Enemy): deathcheck(null)
Enemy (NPC) (/mob/Enemy): Poison(null)
New(Naruto (232,296,1) (/turf/stones))

a few things that I think it could be...

1) Poison proc is getting called Multiple times?
2) Not transfering correctly from the Poison Proc to the Deathcheck proc.

If anyone could help me with this, I would be ever so thankful.
Don't use goto. Ever. For any reason. What you need is a while() loop instead.

As for your error: the argument to Poison is null. Therefore, the owner of the PoisonCloud is null.
In response to Garthor
Blarg, sorry, forgot this part of it...

Code:
obj
Pball
density=1
icon = 'PBall.dmi'
Bump(A)
if(ismob(A))
var/mob/M = A
if(M.INSUNA||M.INKYUU)
return
else if(M.npc||M.INHIJUTSU)
return
else
var/Z = new/obj/PoisonCloud(locate(M.x,M.y,M.z))
Z:owner = src.owner
del(src)
if(istype(A,/turf/))
var/turf/T = A
if(T.density)
del(src)
if(istype(A,/obj/))
del(src)


Thats what creates the PoisonCloud...and yes, the verb to shoot it, does set PBall's owner as the usr...

Also on the goto subject...

Is it because I am using it incorrectly? Or is it just a command that can be...problematic?
In response to Matt3151
You are using it incorrectly in that you are using it. There is no valid usage of goto. Any valid usage you may think of is better accomplished using a different construct, such as if(), while(), or for().

As for your assertion that the Pball's owner is set to anything: you're wrong. It's null. If it weren't null, then you wouldn't be getting the error that you are getting.

Oh, and you should also avoid the : operator. In this case, you would do var/obj/PoisonCloud/Z = new(M.loc), and then . will work.