ID:139500
 
Code:
obj
proc
HitFireArr(mob/O)
sleep(1)
O.hp-=20
O.deathcheck()
O.burning=1
O.burncheck()
O.overlays+=/obj/fire
view()<<"[O.name] gets hit with an arrow for 20 damage, and they begin to burn!"
del(src)

obj
firearrow
icon='Projectiles.dmi'
icon_state="FireArrow"
density=1
New(mob/M)
loc=M.loc
dir=M.dir
FireArr()
return ..()
Bump(atom/O)
if(O.name=="Water")
src.density=0
sleep(3)
src.density=1
else
HitFireArr(O)


Problem description: The fire arrow shoots alright, but when it makes contact with something, it keeps hitting them and they get constantly burned. Can someone help make the arrow disappear when it hits something?

When HitFireArr() calls O.burncheck(), it halts until O.burncheck() finishes. As it does not finish, neither does HitFireArr(), so the arrow is never deleted and so it can just keep on colliding with the mob. You need to use spawn() to execute burncheck() in a separate thread.
In response to Garthor
I had a feeling it had something to do with burn check, because it's the only arrow that has an effect on it. Thanks a lot ;D
In response to Colin1011
There's one more problem I'm having. Now, when burned, the player doesn't take any damage.
        burncheck()
if(src.burned==10)
src<<"The fire wears off."
view()<<"[src.key] stops burning."
src.burning=0
src.burned=0
src.overlays-=/obj/fire
else
if(src.burning==1)
src<<"You burn for 5 damage!"
src.hp-=5
src.deathcheck()
src.burned+=1
sleep(30)
src.burncheck()
In response to Colin1011
Oh, right. If you are putting the spawn() in the arrow's proc, then you need to use spawn(-1) to have it execute the spawned thread before the current thread. Otherwise, with just spawn(), the spawned thread waits for the current thread to finish before taking any action, but since the current thread deletes src, all of its procedures (including the spawned-off and waiting) portion are immediately ended.
In response to Garthor
Thanks. It's fixed now. Dunno what I'd do without your help.
In response to Colin1011
Oh, and something I just thought of:

This would be an excellent place to place a comment along the lines of, "spawn(-1) is used so that it executes immediately rather than waiting for the current proc to sleep" or something that you'd understand later.