I noticed on wod its pretty kewl that when you die everyone knows and you get a bunch of messages from nice players to help you rez and get your stuff back. Then i thought it would be nice if you didnt have to explain where you were at and guide someone to your body. I created this script to have someone just go to your body. What does everyone think?
(what it does) basicly after a character dies, you type .findcorpse <name>
it then creates a skull in the backpack that has the cooridinates of player when the skull is double clicked it moves you to there body and deletes the skull.
First i created an item in the itemdesc.cfg file
I used the skull and called it the skull_of_finding but it could be whatever graphic you wanted.
/////////////////////////////////////////////////////
Item 0xBBCD
{
Name skull_of_finding
Desc Skull of Finding
Graphic 0x1ae2
Script find_dead
}
/////////////////////////////////////////////////////
Then i created the . command in the scripts textcommands for players
/////////////////////////////////////////////////////
// This is .findcorpse a player command to find a
// characters location of death type .findcorpse <name> to use
use uo;
include "include/client";
Const UOBJ_SKULLOFFIND := 0xBBCD;
Program findcorpse (who, tofind)
// Lets see if the person is online who needs to be
// found
var jplayer := FindOnlinePlayerByName (who, tofind);
if (!jplayer)
if (!GetObjProperty (who, "nomsgerrors") )
SendSysMessage (who, "That player is either not online or is in private mode.",FONT_NORMAL, 48);
endif
return;
endif
tofind := jplayer;
//Make sure that the player that died did not use
//the command
if ( who == tofind)
SendSysMessage(who, "Do you really need to find yourself? Really?",FONT_NORMAL, 48);
return;
endif
// This erases any previous corpse data on player
//typing the command
// this maintains clean up as people use findcorpse
EraseObjProperty( who, "x_corpse" );
EraseObjProperty( who, "y_corpse" );
EraseObjProperty( who, "z_corpse" );
// This gets the player's last corpse location
var x,y,z;
x := GetObjProperty( tofind, "x_corpse" );
y := GetObjProperty( tofind, "y_corpse" );
z := GetObjProperty( tofind, "z_corpse" );
// If player's corpse location non existant report
// error to user
if( (x == error) or (y == error) or (z == error) )
SendSysMessage( who, " You could not find " + tofind.name + "'s corpse!", FONT_NORMAL, 48 );
return; //exits the script
endif
// write the results for ghost location on player
// that is to help
SetObjProperty( who, "x_corpse_find", x );
SetObjProperty( who, "y_corpse_find", y );
SetObjProperty( who, "z_corpse_find", z );
// Now check backpack for a previous skull if no
// skull create one
var jfoundskull := 0;
var jtemp := FindObjtypeInContainer( who.backpack,UOBJ_SKULLOFFIND);
if ( Cstr(jtemp.desc) == "a Skull of Finding")
jfoundskull := 1;
endif
// Note jtemp with 0 means no skull and 1 means a skull in backpack
// Now lets create an item in the backpack that will recall to dead person's corpse
// if no skull already exists
if ( jfoundskull == 0 )
CreateItemInContainer( who.backpack,UOBJ_SKULLOFFIND , amount := 1 );
endif
EndProgram
// I borrowed this function from the wod scripts
// Tries to find the best match of an online
// character based on the provided name
function FindOnlinePlayerByName (character, name)
//Try to find an exact match first
foreach onlinechr in EnumerateOnlineCharacters()
if (lower (onlinechr.name) == name)
if (!GetObjProperty (onlinechr, "private"))
return onlinechr;
elseif (character.cmdlevel)
return onlinechr;
endif
endif
endforeach
//Then try to find someone who's name is at least close
foreach onlinechr in EnumerateOnlineCharacters()
var thename := lower (onlinechr.name);
if (thename[name])
if (!GetObjProperty (onlinechr, "private"))
return onlinechr;
elseif (character.cmdlevel)
return onlinechr;
endif
endif
endforeach
return 0;
endfunction
/////////////////////////////////////////////////////
Now in the items directory i created the file to run
after the skull of finding is created.
i named this find_dead.src
/////////////////////////////////////////////////////
use uo;
program find_dead( player, skull ) //remember this is a usescript, and
//these are the parameters passed
//to the script by POL
var x,y,z;
x := GetObjProperty( player, "x_corpse_find" );
y := GetObjProperty( player, "y_corpse_find" );
z := GetObjProperty( player, "z_corpse_find" );
if( (x == error) or (y == error) or (z == error) )
SendSysMessage( player, "The skull has lost it's magical abilities!" );
// destroy the skull used
EraseObjProperty( player, "x_corpse_find" );
EraseObjProperty( player, "y_corpse_find" );
EraseObjProperty( player, "z_corpse_find" );
DestroyItem( skull );
return; //exits the script
endif
MoveCharacterToLocation( player, x, y, z );
EraseObjProperty( player, "x_corpse_find" );
EraseObjProperty( player, "y_corpse_find" );
EraseObjProperty( player, "z_corpse_find" );
DestroyItem( skull );
endprogram