obj/var/tmp
walk = 0
speeding
Move_Delay = 0
Gowner=""
target=""
obj
Ki_Blast
verb
KiBlast()
set category = "Fighting"
set name = "Ki Blast"
if(usr.Doing)
return
if(usr.Firing)
return
if(usr.Frozen)
usr<<"You are frozen."
return
if(usr.Resting)
usr<<"Not while resting."
return
if(usr.Meditating)
usr<<"Not while meditating."
return
if(usr.flying)
usr<<"Not while flying."
return
if(usr.Ki < 10)
usr<<"You need more ki."
return
else
usr.Ki -= 10
usr.Firing = 1
usr.Doing = 1
usr.Frozen = 1
view()<<"<font color = blue>[usr]: Ki Blast!"
var/obj/KiBlast/K = new /obj/KiBlast
K.loc = usr.loc
K.dir = usr.dir
K.Move_Delay=2
K.name="[usr]"
K.Gowner=usr
walk(K,usr.dir)
if (target == null)
del(K)
sleep(5)
usr.Firing = 0
usr.Doing = 0
usr.Frozen = 0
sleep(50)
del(K)
obj
KiBlast
icon = 'Techs.dmi'
icon_state = "Ki Blast"
density = 1
Bump(A)
if(ismob(A))
var/mob/M = A
var/damage = 25
if(damage >= 1)
M.PL -= damage
view(M) << "[M] was hit by [usr.name]'s ki blast for [damage] damage!!"
var/mob/O = src.Gowner
M.DeathCheck(O)
del(src)
if(istype(A,/turf/))
var/turf/T = A
if(T.density)
del(src)
if(istype(A,/obj/))
del(src)
Problem description:
I get this error...
runtime error: Cannot read 0.name
proc name: Bump (/obj/KiBlast/Bump)
usr: 0
src: Zanshin (/obj/KiBlast)
call stack:
Zanshin (/obj/KiBlast): Bump(Bunny {Weak}(1) (/mob/EnemyNPCs/Animals/Bunny))
Zanshin (/obj/KiBlast): Move(Dragon Ball Aftersight (79,13,2) (/turf/Earth/Grass), 4)
I dont understand.
The problem is that you are using usr in your Bump() proc. It is unsafe to assume usr to be 'the user' in procs, while in verbs, it's generally set to the mob of the client who used the verb (unless it's called as a proc).
[Edit] I missed a few lines of your code, you're storing the owner so the problem is that you're using 'usr' in your output statement. Changing it to src.Gowner.name should work. However, you should still use the if statement to check if Gowner didn't log out.
You will have to store the owner of your Ki_Blast (ie. the player that fired it) in the actual object to reference it properly, and then validate your data accordingly (like, considering the fact that the user may log out before the blast hits anything)