ID:146655
 
Code:
mob/pc
proc/enflame(M)
if(fire)
overlays += /obj/overlay/flames
var/i = 1
while(i)
world << i
if(!fire)
return
hp -= 5
if(checkDeath(M))
i = null
fire = 0
world << fire
return
sleep(25)


obj/bullets
density=1
icon_state="bullet"
var/owner


Bump(turf/T)
if(istype(T,/turf/walls))

del(src)
fire
icon='flamer.dmi'

Bump(mob/pc/M)
//here is the effects
if(istype(M,/mob/pc))//if it is a mob
if(M.hp<0)
del(src)
return
M.hp -= 20
M.fire = 1
M.enflame(owner)
M.checkDeath(owner)
..()
del(src)
mob/proc/checkDeath(killer)
if(hp <= 0)
var/client/K = killer
var/client/V = src.client
var/obj/corpse/M = new(loc)
for(var/obj/Inventory/Equipment/O in src)
if(src.vars["[O.identifier]"])
src.vars["[O.identifier]"]=null
O.suffix=null
O.OnRemoval()
O.Move(src.loc)
M.gold = src.client.gold*0.5
M.gold = round(M.gold, 1)
src.client.gold = M.gold
src.client.gold = round(src.client.gold, 1)
src.hp = 100
src.overlays = null
src.client.gun = "none"
src.client.clips = 0
src.ammoRefresh(0)
world << "\red <b>[src] was killed by [killer]"
K.kills += 1


Problem description:
I the enflame() proc to loop 'til mob/pc's checkdeath(owner) is true... owner is the client of the person that shot the bullet... I don't know what's wrong but I strongly suspect that damn dirty loop in the enflame() proc... I'm crap at loops...
Firstly, why not use while(fire) instead of i? Second, you need to explain what is wrong, what is happening and what you want to happen. Thirdly, stop with the ...s, and lastly, you don't actually need to prefix src-related statements with src..
In response to Hazman
I use src. before src related arguments just to remind myself who's doing what, and the ...s are product of a bad habit which verges on medical problem.

K, for what's happening with the while(i) part: the flamethrower bullet hits the mob, does 20 damage, deletes itself,procedes to count the mob's health down to 0, kills the mob, removes the overlays, respawns the mob BUT his health keeps counting down.

Now, without the i and using while(fire): the bullet hits the mob, does 20 damage, then very quickly (without sleeping 20) counts the mob's health down, fails to delete itself, kills the mob etc. and keeps moving until it hits a wall or another mob, in which case it does the same thing again. And then, when the mob respawns his health keeps going down anyway.

I want it so that it hits the mob, deletes itself, then starts the flaming countdown until the mob dies and then respawns with his health not degenerating.

Now, my poor grammar aside, what's wrong and how could I fix it? ty...

In response to Fartmonger
At the place in checkDeath where everything is finished and you don't need to continue the proc any longer, put return 1. this will make your if(checkDeath(M)) part work.
In response to Hazman
pc
pc
proc/enflame(M)

if(fire)
overlays += /obj/overlay/flames

while(fire)

if(!fire)
return
hp -= 2
if(checkDeath(M))

fire = 0

return
else
if(!fire) return
fire = null

spawn(20)
fire =1
enflame(M)

EDIT:OK, what happens now is that after you die, you catch fire again as soon as you respawn. Anything I could do to the above to prevent that???