56 lines
1.2 KiB
Plaintext
56 lines
1.2 KiB
Plaintext
//Created by Genisys/Guile 5/20/08
|
|
//This is a triple check script where we check who is clicking
|
|
//if the locations are valid and if not send them somewhere else.
|
|
|
|
//Put this script OnClick or OnFailToOpen
|
|
void main()
|
|
{
|
|
|
|
object oPC = GetClickingObject();
|
|
object oTarget;
|
|
location lTarget;
|
|
|
|
//If it's a PC port them home (town)
|
|
if(GetIsPC(oPC))
|
|
{
|
|
oTarget = GetWaypointByTag("home");
|
|
|
|
lTarget = GetLocation(oTarget);
|
|
//This location is valid, but this is here for saftey measures.
|
|
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
AssignCommand(oPC, ActionJumpToLocation(lTarget));
|
|
}
|
|
|
|
//Otherwise it must be a dm or creature, so...
|
|
else
|
|
{
|
|
|
|
lTarget = GetLocalLocation(oPC, "ls_stored_loc");
|
|
|
|
//If the DM didn't use the door, then port them to town.
|
|
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID)
|
|
{
|
|
oTarget = GetWaypointByTag("home");
|
|
|
|
lTarget = GetLocation(oTarget);
|
|
|
|
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
AssignCommand(oPC, ActionJumpToLocation(lTarget));
|
|
}
|
|
//Teleport the DM to town (because they used the door)
|
|
else
|
|
{
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
AssignCommand(oPC, ActionJumpToLocation(lTarget));
|
|
}
|
|
}
|
|
|
|
}
|