ID:1891949
 
Code:
mob
proc/Poison(mob/M as mob)
if(M.Clan=="Human Puppet"||M.Clan=="Puppet"||M.inimmortal)
M.poisoned=0
var/damage = rand(10,20,)
M.poisoned=1
M.health-=damage
if(M.health <= 0)
src.deathcheck(M)
sleep(rand(50,100))
if(poisoned==1)
Poison(src)
else
return..()

obj
Pball
density=1
icon = 'PBall.dmi'
Bump(A)
if(ismob(A))
var/mob/M = A
var/mob/O = src.owner
var/obj/PoisonCloud/Z = new/obj/PoisonCloud (locate(M.x,M.y,M.z))
Z.owner = O
var/obj/PoisonCloud/Z1 = new/obj/PoisonCloudleft (locate(M.x-1,M.y,M.z))
Z1.owner = O
var/obj/PoisonCloud/Z2 = new/obj/PoisonCloudright (locate(M.x+1,M.y,M.z))
Z2.owner = O
var/obj/PoisonCloud/Z3 = new/obj/PoisonClouddown (locate(M.x,M.y-1,M.z))
Z3.owner = O
var/obj/PoisonCloud/Z4 = new/obj/PoisonCloudup (locate(M.x,M.y+1,M.z))
Z4.owner = O
var/obj/PoisonCloud/Z5 = new/obj/PoisonCloudleftup (locate(M.x-1,M.y+1,M.z))
Z5.owner = O
var/obj/PoisonCloud/Z6 = new/obj/PoisonCloudrightup (locate(M.x+1,M.y+1,M.z))
Z6.owner = O
var/obj/PoisonCloud/Z7 = new/obj/PoisonCloudleftdown (locate(M.x-1,M.y-1,M.z))
Z7.owner = O
var/obj/PoisonCloud/Z8 = new/obj/PoisonCloudrightdown (locate(M.x+1,M.y-1,M.z))
Z8.owner = O
if(M.InKawarimi<=0)
M.poisoned = 1
M.Poison(O)
else
M.Kawarimi_Teleport()
sleep(2)
del(src)


if(istype(A,/turf/))
var/turf/T = A
if(T.density)
del(src)
if(istype(A,/obj/))
del(src)
New()
spawn(27)
del(src)

mob/Puppets
verb
PBall()
set category="Puppetry"
set name="Posion Smoke Bomb"
for(var/mob/Puppets/Puppet/E in world)
if(E.owner==usr)
if(E.fired)
usr<<"You just used this, wait 10 seconds..."
else
if(usr.petout)
E.fired=1
var/obj/Pball/H = new()
H.loc=E.loc
H.dir=E.dir
H.owner=usr
walk(H,H.dir)
sleep(20)
E.fired=0
for(var/mob/Puppets/Kaze/E in world)
if(E.owner==usr)
if(E.fired)
usr<<"You just used this, wait 10 seconds..."
else
if(usr.petout)
var/obj/Pball/H = new()
H.loc=E.loc
H.dir=E.dir
H.owner=E
walk(H,H.dir)
E.fired=1
sleep(20)
E.fired=0
for(var/mob/Puppets/SasoriPuppet/E in world)
if(E.owner==usr)
if(E.fired)
usr<<"You just used this, wait 10 seconds..."
else
if(usr.petout)
var/obj/Pball/H = new()
H.loc=E.loc
H.dir=E.dir
H.owner=usr
walk(H,H.dir)
E.fired=1
sleep(20)
E.fired=0


Problem description:
the proc for some reason doesn't call on deathcheck properly. it says that the one poisoned killed themselves. but i want it to say the owner of the poison killed them.
There's a couple ways to explain this because it's a simple mix-up between your variables.

In /obj/PBall/Bump(A), you call M.Poison(O), where M is the mob that the poison ball hit, and O is the owner of the poison ball.

In /mob/Poison(M), according to /obj/PBall/Bump, src should be the poisoned mob and M should be the poisoner. However, you're treating M as the poisoned mob, and you call src.Poison(src), which completely loses the poisoner after the first iteration.
mob
proc/Poison(mob/M as mob)
if(M.Clan=="Human Puppet"||M.Clan=="Puppet"||M.inimmortal)
M.poisoned=0
var/damage = rand(10,20,)
M.poisoned=1
M.health-=damage
if(M.health <= 0)
src.deathcheck(M)
sleep(rand(50,100))
if(poisoned==1)
Poison(M)
else
return..()

should work?
In response to Louisthe10
In PBall/Bump(), you're calling poisoned.Poison(poisoner). This means that inside mob/Poison(M), src is the poisoned mob and M is the poisoner. Currently, you're dealing damage to the poisoner.
obj
Pball
density=1
icon = 'PBall.dmi'
Bump(A)
if(ismob(A))
var/mob/M = A
var/mob/O = src.owner
var/obj/PoisonCloud/Z = new/obj/PoisonCloud (locate(M.x,M.y,M.z))
Z.owner = O
var/obj/PoisonCloud/Z1 = new/obj/PoisonCloudleft (locate(M.x-1,M.y,M.z))
Z1.owner = O
var/obj/PoisonCloud/Z2 = new/obj/PoisonCloudright (locate(M.x+1,M.y,M.z))
Z2.owner = O
var/obj/PoisonCloud/Z3 = new/obj/PoisonClouddown (locate(M.x,M.y-1,M.z))
Z3.owner = O
var/obj/PoisonCloud/Z4 = new/obj/PoisonCloudup (locate(M.x,M.y+1,M.z))
Z4.owner = O
var/obj/PoisonCloud/Z5 = new/obj/PoisonCloudleftup (locate(M.x-1,M.y+1,M.z))
Z5.owner = O
var/obj/PoisonCloud/Z6 = new/obj/PoisonCloudrightup (locate(M.x+1,M.y+1,M.z))
Z6.owner = O
var/obj/PoisonCloud/Z7 = new/obj/PoisonCloudleftdown (locate(M.x-1,M.y-1,M.z))
Z7.owner = O
var/obj/PoisonCloud/Z8 = new/obj/PoisonCloudrightdown (locate(M.x+1,M.y-1,M.z))
Z8.owner = O
if(M.InKawarimi<=0)
M.poisoned = 1
M.Poison()
else
M.Kawarimi_Teleport()
sleep(2)
del(src)


if(istype(A,/turf/))
var/turf/T = A
if(T.density)
del(src)
if(istype(A,/obj/))
del(src)
New()
spawn(27)
del(src)
<dm>
tried it that way got run time errors
In response to Louisthe10
M.Poison() means you aren't passing anything to Poison(). Poison expects a single argument, to which it refers M. You know, the M in Poison() has nothing to do with the M in Bump().
im still confused :/