ID:141543
 
Code:
obj
kunai
icon = 'kunai.dmi'
icon_state = ""
density = 1
New()
spawn(100)
del src
Bump(A)
if(istype(A,/obj/log))
usr.Train()
del(src)

if(ismob(A))
var/mob/M = A
if(M == src.Gowner)
del src
return
var/mob/O = src.Gowner
var/damage = O.Chakrapower * 3- M.Chakrapower
if(damage < 1)
damage = 1

M.Hp -= damage
view(O,8) << "<font size = 1><font color = red>[O] hit [M] with his kunai for [damage] damage!"
M.Death(O)
del(src)


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


Problem description:


when it bumps against the logi get a run time how do i make it run the proc when it hits the log?

<font color=fuchsia size=4>Ungh. No usr in proc.</font>
FYI, it is also not needed to manually attempt to stop the proc after deleting src; it's stopped regardless anyway. You also don't need the typecasted var T if you just initially define A as of any atom type.
It's also not needed to check the obstacle's density, since if something bumped into it then it is very obviously dense. So you could say you could combine the 2 last if()s to one, but then you don't even need those checks at all; if the obstacle isn't a mob, then it is sure to be an obj or a turf. Also, you're always deleting src in the end no matter what, so you can just put the statement to do so once in the end instead of at the end of every if() block.
Please paste a copy of the error here, including which line it's on (to get that information, run it in debug mode)
Assuming usr.Train() is the error:
You need to add a mob/Owner variable to the kunai, set it when somebody throws it, then run src.Owner.Train() if it hits a log.
EDIT: Seems like the Gowner variable may already be set to what you need. Though I can't see its declaration or assignments.