Setting area to warp to when you die?

Hi, first post.

How do you pick where a player warps to when he dies? Usually it's when you first log on but that can be an inconvenience if you've been questing for like an hour and you warp back ten miles.

Re: Setting area to warp to when you die?

K edited, Put this in the system npc of the player. It should work right,

 if (playerenters) {
 setstring levelname,#L;
}
if (playerdies){
 setlevel #s(level);
}

Re: Setting area to warp to when you die?

I'm unsure what causes it, but it could be looked into for you :).

Re: Setting area to warp to when you die?

Thanks. I’m pretty new to this version of graal (i’m one of those “I updated to this from an ancient barely playable version of graal”, y’know) and i’m assuming the system npc is a npc you should get as soon as you start the game and you always have it?

Re: Setting area to warp to when you die?

Yeah, exactly man. If you put a dash before the weapon name you give to the player they won't even see it in their inventory. Like
toweapons -systemnpc;

Re: Setting area to warp to when you die?

Thanks for the tip. If it has - can it still be used as a weapon? (so I can hide swordsonly)

Re: Setting area to warp to when you die?

Okay there's a problem. When you die the level changes while you're dead, so when you respawn it puts you back to where you first connected again ???

Re: Setting area to warp to when you die?

lol put a sleep timer before the setlevel.

like if(playerdies) { sleep 0.1; setlevel2 #L,playerx,playery; }
The sleep timer will be frozen when paused, (in this case, dead), so it will be reactivated once they resurrect. Hopefully with time, we'll get it imported into the GServer to respawn at the location of death like in later versions of Graal.

Re: Setting area to warp to when you die?

Still isn't working. The level doesn't change at all with the sleep there. :frowning:

Re: Setting area to warp to when you die?

sorry, suppose I have it saving the former location of the player on my server, rather than in the example I showed you.
Merge them sort'o'speak. Put a sleep infront of the setlevel

Re: Setting area to warp to when you die?

you could have a second value that is set along with the level in the died frame. Like guydied=1;

if (playerdies){
guydied=1;
}

then have if statement

if(guydied==1&&!strequals(#L,#s(levelname)){
setlevel #s(levelname);
guydied=0;
}

I noticed when I first gave you an example I had it say
setlevel #s(level);
instead of setlevel #s(levelname); , sorry. So if you left it the original way, that may have been a reason for it not working(or the gserver makes the levelwarp to the level you connected on, after respawning from death, in which case try the 2nd example I just posted).

Re: Setting area to warp to when you die?

im Guessing that it should be the first level but then u can change that make checkpoints or sumthing ;D

Re: Setting area to warp to when you die?

Why can't we all just, get along?

//NPC #1, CheckPoint
if(playerenters) set checkpoint,#L,32,32;

//NPC #2, Respawn System NPC
if(playerdies) {
sleep 0.05; //Delay till respawn
for(this.i = 0; this.i < 4; this.i ++){ //Respawning isn't perfect, you can still warp back sometimes.
tokenize #s(checkpoint);
setlevel2 #t(0),strtofloat(#t(1)),strtofloat(#t(2));
sleep 0.05;
}
}