ID:263551
 
Code:
    proc/death_check(mob/M as mob)
if(Safe == 1)
M<<"You can not kill this npc"
return
if(src.Health <= 0)
M <<"You killed [src]!"
M.Exp += rand(src.NPCExp,src.NPCMaxExp)
M.level_up()
if(src.client)
src <<"[M] killed you!"

src.loc = locate(src.locX,src.locY,src.locZ)
src.Health = src.Maxhealth

src.Status = "None"
src.Mana = src.MaxMana
src.Stamina = src.MaxStamina
src.Safe = 1
sleep 100
src.Safe = 0
else
src <<"You have been killed by now that [M]!"
del(src)


Problem description:

When you die some how you get a black screen. It happens when you get killed my npcs or real players any ideas would help.
src.loc = locate(src.locX,src.locY,src.locZ)


The problem is most likely with wherever you set those variables. If it is sending you to an invalid location, then your screen will be black.

Add this verb to your game and run it right before you die. What does it output?

mob/verb/Test_Locs()
set category="Debug"
usr << "Your locX is: [locX]
usr << "Your locY is: [locY]
usr << "Your locZ is: [locZ]


If it does not give valid coordinates, then we've definitely isolated the problem.
In response to Zagreus
Uh. Might as well just simply add something like this after the src.loc = locate(src.locX,src.locY,src.locZ):
if(!src.loc) //invalid loc. null.
src << "invalid loc! (coords [locX],[locY],[locZ])"
In response to Kaioken
Well sure, if you wanna do it the easy way. :)
Game Killer wrote:
Code:
>   proc/death_check(mob/M as mob)
> if(Safe == 1)
> M<<"You can not kill this npc"
> return
> if(src.Health <= 0)
> M <<"You killed [src]!"
> M.Exp += rand(src.NPCExp,src.NPCMaxExp)
> M.level_up()
> if(src.client)
> src <<"[M] killed you!"
>
> src.loc = locate(src.locX,src.locY,src.locZ)
> src.Health = src.Maxhealth
>
> src.Status = "None"
> src.Mana = src.MaxMana
> src.Stamina = src.MaxStamina
> src.Safe = 1
> sleep 100
> src.Safe = 0
> else
> src <<"You have been killed by now that [M]!"
> del(src)
>


There are a few things wrong with this.

1)death_check(mob/M as mob)>>M is the mob this proc is being called on, not whoever killed the person. src is also M in this case.

2)What you'll need to do, is make a killer verb for mobs, and set the killer variable in your attack verb/proc.

3) And as he said, it's likely that locX, locY, and locZ are null. Make sure to set them somewhere otherwise it will either died and revive in the same spot(if you return), or a black screen.
In response to Zagreus
Yes, I do!

ughgugh

I mean, I have a valid reason!
If you're having it like that, there, it is surely to reproduce the problem and output the correct values at the time of it occuring - since it checks for the problem directly after it may happen.

Yeah, thats my excuse and I'm sticking to it!
In response to Pyro_dragons
Pyro_dragons wrote:
3) And as he said, it's likely that locX, locY, and locZ are null. Make sure to set them somewhere otherwise it will either died and revive in the same spot(if you return), or a black screen.

Well, that isn't what I and (:P) Zagerus said; it may not be as simple as that. Maybe all the coord vars are valid numbers, but together they don't make out a valid coordinate, such as referring to a coord beyond the map, ie the coords are 35,24,1 but the map is only 30x30.