ID:145157
 
i keep getting this error whenever i us my attack button.
runtime error: Cannot read null.key
proc name: DeathCheck (/mob/proc/DeathCheck)
usr: MagicMan (/mob/character)
src: Tidus (/mob/Tidus)
call stack:
Tidus (/mob/Tidus): DeathCheck(Tidus (/mob/Tidus))
Wooden Sword (/obj/Wooden_Sword): Slash()
It would be useful to show us some code.
In response to Popisfizzy
Code:
mob
var/mob/b
proc
DeathCheck(mob/b as mob)
if(src.hp <= 0)
if(!src.client.key)
if(usr.Talking)
usr.Talking = 0
usr << "You have killed [src]"
usr.loc = locate(11,13,5)
usr.Cannot_Attack = 1
usr.exp += src.lvl
usr.LevelCheck()
del(src)
else
src.loc = locate(40,40,3)
usr.exp += src.lvl
usr.LevelCheck()
sleep(600)
src.loc = locate(36,14,5)
src.hp = src.mhp
if(!usr.client.key)
if(src.Talking)
src.Talking = 0
src << "[usr] has killed you."
src.loc = locate(2,10,3)
src.dead = "yes"
src << "You wil be revived in 5 seconds"
usr.exp += src.lvl
usr.LevelCheck()
sleep(50)
src.dead = "no"
src.loc = locate(17,13,5)
src.Cannot_Attack = 1
src.hp = src.mhp
del(usr)
else
src.loc = locate(2,10,3)
src.dead = "yes"
src << "You wil be revived in 5 seconds"
usr.exp += src.lvl
usr.LevelCheck()
sleep(50)
src.dead = "no"
src.loc = locate(17,13,5)
src.Cannot_Attack = 1
src.hp = src.mhp
src.Bars()
else
usr.frgt = 1


Problem description:

runtime error: Cannot read null.key
proc name: DeathCheck (/mob/proc/DeathCheck)
usr: MagicMan (/mob/character)
src: Tidus (/mob/Tidus)
call stack:
Tidus (/mob/Tidus): DeathCheck(Tidus (/mob/Tidus))
Wooden Sword (/obj/Wooden_Sword): Slash()
In response to MagicBLC13
You pass an argument, and then you never use it. I think you wanted b instead of usr, and you never checked to see if b was actually a player (after replacing usr with b), and you're trying to access it's client, which is null, so you're getting this runtime error!