45 lines
1.9 KiB
Plaintext
45 lines
1.9 KiB
Plaintext
// send to start location based on conversation
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetLastSpeaker();
|
|
|
|
if(GetIsPC(oPC)||(GetIsDM(oPC) && !GetIsDMPossessed(oPC))) // Script will fire for PCs and DMs
|
|
{
|
|
string sPCName = GetName(oPC); // Gets the name of the PC
|
|
string CDKey = GetPCPublicCDKey(oPC); // Gets the public CD Key of the player . . . adds to quality of check
|
|
string sID = GetStringLeft(sPCName,10); // Indivudual Character Used
|
|
string sHID = sID+CDKey; // HCR Style user check
|
|
|
|
// Read Persistent Location Data
|
|
int nPlayerBeenHere = GetCampaignInt("PlayerStartLoc", "StartLocSet_" + sHID, oPC); // The check to see if PC has a saved location
|
|
int nAreaX = GetCampaignInt("PlayerStartLoc", "AreaX_" + sHID, oPC);
|
|
int nAreaY = GetCampaignInt("PlayerStartLoc", "AreaY_" + sHID, oPC);
|
|
int nAreaZ = GetCampaignInt("PlayerStartLoc", "AreaZ_" + sHID, oPC);
|
|
string sAreaName = GetCampaignString("PlayerStartLoc", "AreaName_" + sHID, oPC);
|
|
string sAreaTag = GetCampaignString("PlayerStartLoc", "AreaTag_"+ sHID, oPC);
|
|
|
|
// Set up the location from Database info
|
|
float y = IntToFloat(nAreaY);
|
|
float x = IntToFloat(nAreaX);
|
|
float z = IntToFloat(nAreaZ);
|
|
vector vTargetLoc = Vector(x, y, z);
|
|
location lTargetLoc = Location(GetArea(GetObjectByTag(sAreaTag)), vTargetLoc, 0.0);
|
|
|
|
// Check if player has a saved location
|
|
if (nPlayerBeenHere == 1)
|
|
{
|
|
if (GetCurrentHitPoints(oPC)<=0) // See if the PC has 0 or less HPs . . . added this for HCR death system
|
|
{
|
|
SendMessageToPC(oPC,"You are still be dead...");
|
|
}
|
|
|
|
else // If the PC is above 0 HPs, send them to their last save location
|
|
{
|
|
SendMessageToPC(oPC,"Portaling to your Saved Location in 3 Seconds...");
|
|
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTargetLoc)));
|
|
}
|
|
}
|
|
}
|
|
}
|