ID:146966
 
runtime error: Cannot read null.name
proc name: Die (/mob/proc/Die)
source file: Battle_system.dm,155
usr: 0
src: Ahzulez (/mob/characters/android)
call stack:
Ahzulez (/mob/characters/android): Die()
Head (/obj/Beams/Head): Bump(Ahzulez (/mob/characters/android))
Head (/obj/Beams/Head): Move(the kgrass (20,11,1) (/turf/Kaioshin/kaioshindmi/kgrass), 2)



I get this error when i shoot the ki blast at a player when they meet death requirements. The death proc works fine for my finish verb but not when i use it in the ki blast thingy.


            Bump(atom/A)
if(istype(A,/mob/))// If whatever the head bumps is a mob...
var/mob/M=A
view(owner) << "[src.owner]'s [src.aname] hits [M]!" // For all in the owner's view, gives a message
M.damage += ((owner.powerlevel/M.powerlevel) * 7)
M.Die()
src.density = 0
sleep(5)
src.density = 1
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head
else if(istype(A,/turf/)) // If whatever the head bumps is a turf..
owner.kame = 0 // Allow the owner to fire another beam
owner.icon_state = "" // Give them their default icon_state
owner.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head
else
if(!ismob(A) && !isturf(A) && !isobj(A) && !isarea(A))
owner.kame = 0 // Allow the owner to fire another beam
owner.icon_state = "" // Give them their default icon_state
owner.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head


Above is the piece of coding where i use the death proc in the base of the ki beam coding.


here is the code for the ki blast
mob
proc
kiblast()
set category = "Fighting"
set name = "Ki Blast"
src.head = 'Blast.dmi'
src.tail = 'Blast.dmi'
src.aname = "Ki Blast"
src.kiamount = src.maxki / 100
if(src.kame) // If the mob's kame var is one...
src << "This cannot be done."
return
else if(src.kiamount > src.ki)
src <<"Not Enough Ki"
else
view(6) << "HA!!"
src.ki -= kiamount
src.kame = 1 // Sets the kame var to 1, so he cant fire another beam
src.move = 0 // Disables the mob's movement
src.icon_state = "" // Sets the mob's icon_state
src.Beam() // Calls the Beam() proc
sleep(10)
src.kame = 0


Thx in advance.
Question: Did you even take time to read the runtime?(No offence or anything). Read the bold line, can you please post the die proc?

runtime error: Cannot read null.name
proc name: Die (/mob/proc/Die)
source file: Battle_system.dm,155
usr: 0
src: Ahzulez (/mob/characters/android)
call stack:
Ahzulez (/mob/characters/android): Die()
Head (/obj/Beams/Head): Bump(Ahzulez (/mob/characters/android))
Head (/obj/Beams/Head): Move(the kgrass (20,11,1) (/turf/Kaioshin/kaioshindmi/kgrass), 2)

In response to Lenox
Lenox wrote:
Question: Did you even take time to read the runtime?(No offence or anything). Read the bold line, can you please post the die proc?

runtime error: Cannot read null.name
proc name: Die (/mob/proc/Die)
source file: Battle_system.dm,155
usr: 0
src: Ahzulez (/mob/characters/android)
call stack:
Ahzulez (/mob/characters/android): Die()
Head (/obj/Beams/Head): Bump(Ahzulez (/mob/characters/android))
Head (/obj/Beams/Head): Move(the kgrass (20,11,1) (/turf/Kaioshin/kaioshindmi/kgrass), 2)

Opps. Honestly i thought i put it in there. I'm stupid here it is

mob
proc
Die()
if(src.damage >= 100)
if(!client)
del(src)
else
var/mob/A
if(src.race == "Android")
src << "<b>You get blown to pieces, and you begin to get built by Dr. Gero!"
src.loc=locate(125,145,3)
src.dead=1
src.damage = 0
src<<"You have been sent here to wait while Dr.Gero rebuilds you."
sleep(1000)
src.loc=locate(56,111,3)
src.dead=0

else
if(src.dead == 1)

src << "You have died again!"
src.icon_state = ""
sleep(10)
src.dead = 1
src.safe = 1
src.ko = 0
src.damage = 0
src.grav = 0
src.density = 1
if(src.dead == 0)
if(src.name == A.name)<<<<<<----155
view(6) << "<font color = red><i>[src] dies right infront of you!"
world << "<font color = red><b><i>[src] has killed himself."
else
view(6) << "<font color = red><i>[src] dies right infront of you!"
world << "<font color = green><b>[src] has been killed by [A].<b>"
// for(var/obj/dragonballs/O in src.contents)
// O.loc = locate(src.x,src.y,src.z)

src.loc=locate(54,9,3)
src.powerlevel = src.maxpowerlevel
src.damage = 0
src.icon_state = ""
src.safe = 1
src.dead = 1
src.overlays += 'halo.dmi'
src.grav = 0
src.density = 1
src.ko = 0
sleep(10)


for(var/mob/characters/M in oview(6))
if(usr.befriend == M.name)
if(M.angered == 1)
usr.powerlevel += 0
if(M.angered == 0)
view(10) << "<b><font color = blue>[M.name]: THATS ENOUGH!!!!!!!!!!!!"
view(10) << "<i><b><font color = red>[M.name] explodes in anger as he sees his best friend die!"
M.underlays += /obj/whiteaura
M.powerlevel = (M.powerlevel * 4)
M.ragename = src.name
M.angered= 1
M << "<font color = red><font size = 5>Hate <font color = blue>fills your soul as you see your best friend, [src.name], die infront of you."
sleep(600)
M.underlays -= /obj/whiteaura
M.angered = 0
if(M.powerlevel <= M.maxpowerlevel)
M.powerlevel += 0
if(M.powerlevel > M.maxpowerlevel)
M.powerlevel = M.maxpowerlevel
else
if(usr.angered == 1)
usr.powerlevel += 0
if(usr.angered == 0)
view(6) << "<b><font color = blue>[M.name]: aaaAAAHHHHH!!!!!!!!!!"
view(6) << "<i><b><font color = red>[M.name] explodes in anger as a huge aura surrounds him!"
M.underlays += /obj/whiteaura
M.powerlevel = (M.powerlevel * 2)
M.angered = 1
M.ragename = src.name
M << "<font color = red>Hate <font color = blue>fills your soul as you see [src.alignment] [src.name] die infront of you."
sleep(100)
M.underlays -= /obj/whiteaura
M.angered = 0
if(M.powerlevel <= M.maxpowerlevel)
M.powerlevel += 0
if(M.powerlevel > M.maxpowerlevel)
M.powerlevel = M.maxpowerlevel
else
usr.powerlevel += 0

In response to Kaminoshi
Now can you please edit the die proc and put a comment on line 155 saying <-----This is it---->?

edit: also, NO USR IN PROC PERIOD :P
Read the runtime error one last time:


runtime error: Cannot read null.name
proc name: Die (/mob/proc/Die)
source file: Battle_system.dm,155
usr: 0
src: Ahzulez (/mob/characters/android)
call stack:
Ahzulez (/mob/characters/android): Die()
Head (/obj/Beams/Head): Bump(Ahzulez (/mob/characters/android))
Head (/obj/Beams/Head): Move(the kgrass (20,11,1) (/turf/Kaioshin/kaioshindmi/kgrass), 2)

Notice that usr = 0, that's what is wrong with using usr, usr isn't always a player, whie src is always a player.
Try this, you'll have to fix the indentation, it should work, if it doesn't compile, just remove that for(var/mob/A in world) loop and replace with what you had before.
mob
proc
Die()
if(src.damage >= 100)
if(!client)
del(src)
else
for(var/mob/A in world)
if(src.race == "Android")
src << "<b>You get blown to pieces, and you begin to get built by Dr. Gero!"
src.loc=locate(125,145,3)
src.dead=1
src.damage = 0
src<<"You have been sent here to wait while Dr.Gero rebuilds you."
sleep(1000)
src.loc=locate(56,111,3)
src.dead=0

else
if(src.dead == 1)

src << "You have died again!"
src.icon_state = ""
sleep(10)
src.dead = 1
src.safe = 1
src.ko = 0
src.damage = 0
src.grav = 0
src.density = 1
if(src.dead == 0)
if(src.name == A.name) //<<<<<<----155
view(6) << "<font color = red><i>[src] dies right infront of you!"
world << "<font color = red><b><i>[src] has killed himself."
else
view(6) << "<font color = red><i>[src] dies right infront of you!"
world << "<font color = green><b>[src] has been killed by [A].<b>"
// for(var/obj/dragonballs/O in src.contents)
// O.loc = locate(src.x,src.y,src.z)

src.loc=locate(54,9,3)
src.powerlevel = src.maxpowerlevel
src.damage = 0
src.icon_state = ""
src.safe = 1
src.dead = 1
src.overlays += 'halo.dmi'
src.grav = 0
src.density = 1
src.ko = 0
sleep(10)


for(var/mob/characters/M in oview(6))
if(src.befriend == M.name)
if(M.angered == 1)
src.powerlevel += 0
if(M.angered == 0)
view(10) << "<b><font color = blue>[M.name]: THATS ENOUGH!!!!!!!!!!!!"
view(10) << "<i><b><font color = red>[M.name] explodes in anger as he sees his best friend die!"
M.underlays += /obj/whiteaura
M.powerlevel = (M.powerlevel * 4)
M.ragename = src.name
M.angered= 1
M << "<font color = red><font size = 5>Hate <font color = blue>fills your soul as you see your best friend, [src.name], die infront of you."
sleep(600)
M.underlays -= /obj/whiteaura
M.angered = 0
if(M.powerlevel <= M.maxpowerlevel)
M.powerlevel += 0
if(M.powerlevel > M.maxpowerlevel)
M.powerlevel = M.maxpowerlevel
else
if(src.angered == 1)
src.powerlevel += 0
if(src.angered == 0)
view(6) << "<b><font color = blue>[M.name]: aaaAAAHHHHH!!!!!!!!!!"
view(6) << "<i><b><font color = red>[M.name] explodes in anger as a huge aura surrounds him!"
M.underlays += /obj/whiteaura
M.powerlevel = (M.powerlevel * 2)
M.angered = 1
M.ragename = src.name
M << "<font color = red>Hate <font color = blue>fills your soul as you see [src.alignment] [src.name] die infront of you."
sleep(100)
M.underlays -= /obj/whiteaura
M.angered = 0
if(M.powerlevel <= M.maxpowerlevel)
M.powerlevel += 0
if(M.powerlevel > M.maxpowerlevel)
M.powerlevel = M.maxpowerlevel
else
src.powerlevel += 0

In response to Lenox
Lenox wrote:
Notice that usr = 0, that's what is wrong with using usr, usr isn't always a player, whie src is always a player.

That's not true. "usr" will always be a mob. The problem? "usr", unlike src, is, in laymen's terms, the last mob to do something. So, in MANY cases, especially turf/Entered()-like procs, usr isn't going to be the mob you want.
In response to Wizkidd0123
I think I understand now(I will forget that piece of information within 24 hours) :-P But the error still suggests that usr is null o_O. He had 6 "Usrs" in his proc :P
In response to Lenox
I fixed the runtime error using Die(var/mob/killer). Now i'm wonder how to make the players name who is the killer appear when the kill someone?
In response to Kaminoshi
?
[killer] has killed [src]

You may have to flip it around, but, it works. :P
In response to Hell Ramen
thx i'll do that
In response to Kaminoshi
//Death proc
mob
proc
Die(var/mob/killer)
if(src.damage >= 100)
if(!client)
del(src)
else
if(src.race == "Android")
src << "<b>You get blown to pieces, and you begin to get built by Dr. Gero!"
src.loc=locate(125,145,3)
src.dead=1
src.deaths +=1
src.damage = 0
src<<"You have been sent here to wait while Dr.Gero rebuilds you."
if(src == killer)
view(6) << "<font color = red><i>[src] dies right infront of you!"
src.deaths+=1
world << "<font color = red><b><i>[src] has killed himself."
else
view(6) << "<font color = red><i>[src] dies right infront of you!"
src.deaths +=1
world << "<font color = green><b>[killer] has killed [src].<b>"
// for(var/obj/dragonballs/O in src.contents)
// O.loc = locate(src.x,src.y,src.z)
sleep(1000)
src.loc=locate(56,111,3)
src.dead=0
else
if(src.dead == 1)
src << "You have died again!"
src.icon_state = ""
sleep(10)
src.dead = 1
src.safe = 1
src.ko = 0
src.damage = 0
src.grav = 0
src.density = 1
src.powerlevel = src.maxpowerlevel
src.loc=locate(54,9,3)
if(src.dead == 0)
if(src == killer)
view(6) << "<font color = red><i>[src] dies right infront of you!"
src.deaths+=1
world << "<font color = red><b><i>[src] has killed himself."
else
view(6) << "<font color = red><i>[src] dies right infront of you!"
src.deaths +=1
world << "<font color = green><b>[killer] has killed [src].<b>"
// for(var/obj/dragonballs/O in src.contents)
// O.loc = locate(src.x,src.y,src.z)
src.loc=locate(54,9,3)
src.powerlevel = src.maxpowerlevel
src.damage = 0
src.icon_state = ""
src.safe = 1
src.dead = 1
src.overlays += 'halo.dmi'
src.grav = 0
src.density = 1
src.ko = 0
sleep(10)
for(var/mob/characters/M in oview(6))
if(src.befriend == M.name)
if(M.angered == 1)
src.powerlevel += 0
if(M.angered == 0)
view(10) << "<b><font color = blue>[M.name]: THATS ENOUGH!!!!!!!!!!!!"
view(10) << "<i><b><font color = red>[M.name] explodes in anger as he sees his best friend die!"
M.underlays += /obj/whiteaura
M.powerlevel = (M.powerlevel * 4)
M.ragename = src.name
M.angered= 1
M << "<font color = red><font size = 5>Hate <font color = blue>fills your soul as you see your best friend, [src.name], die infront of you."
sleep(600)
M.underlays -= /obj/whiteaura
M.angered = 0
if(M.powerlevel <= M.maxpowerlevel)
M.powerlevel += 0
if(M.powerlevel > M.maxpowerlevel)
M.powerlevel = M.maxpowerlevel
else
if(src.angered == 1)
src.powerlevel += 0
if(src.angered == 0)
view(6) << "<b><font color = blue>[M.name]: aaaAAAHHHHH!!!!!!!!!!"
view(6) << "<i><b><font color = red>[M.name] explodes in anger as a huge aura surrounds him!"
M.underlays += /obj/whiteaura
M.powerlevel = (M.powerlevel * 2)
M.angered = 1
M.ragename = src.name
M << "<font color = red>Hate <font color = blue>fills your soul as you see [src.alignment] [src.name] die infront of you."
sleep(100)
M.underlays -= /obj/whiteaura
M.angered = 0
if(M.powerlevel <= M.maxpowerlevel)
M.powerlevel += 0
if(M.powerlevel > M.maxpowerlevel)
M.powerlevel = M.maxpowerlevel
else
src.powerlevel += 0


Won't display killer name in the death message.
In response to Kaminoshi
What does it display?
In response to Hell Ramen
has killed "player who died"
In response to Kaminoshi
view(5) << "[killer.name] has killed [src]!"


Try that...>_>