We use this script to save the PC's location, and it works fine through a server reset. An external database is not needed.
void main()
{
object oPC = GetPCSpeaker();
object oArea = GetArea(oPC);
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;
string sAreaName = GetName(oArea); // Sets up a string using the name of the Area
string sAreaTag = GetTag(oArea); // Sets up a string using the Tag of the Area
if(GetIsPC(oPC)||(GetIsDM(oPC) && !GetIsDMPossessed(oPC))) // Script will fire for PCs and DMs
{
vector vPosition = GetPositionFromLocation(GetLocation(oPC));
float nX = vPosition.x;
float nY = vPosition.y;
float nZ = vPosition.z;
int nAreaX = FloatToInt(nX);
int nAreaY = FloatToInt(nY);
int nAreaZ = FloatToInt(nZ);
string sAreaX = IntToString(nAreaX);
string sAreaY = IntToString(nAreaY);
string sAreaZ = IntToString(nAreaZ);
// Set an Int so we can check for a saved location in the portal or trigger
SetCampaignInt("PlayerStartLoc", "StartLocSet_" + sHID, 1, oPC);
// Create Persistent Location Data
SetCampaignInt("PlayerStartLoc", "AreaX_" + sHID, nAreaX, oPC);
SetCampaignInt("PlayerStartLoc", "AreaY_" + sHID, nAreaY, oPC);
SetCampaignInt("PlayerStartLoc", "AreaZ_" + sHID, nAreaZ, oPC);
SetCampaignString("PlayerStartLoc", "AreaTag_"+ sHID, sAreaTag, oPC);
// Tell the player what the Saved Area will be for verification
SendMessageToPC(oPC, "Persistent Saved Location is " + sAreaName);
// Apply a visual effect.
effect eVFX;
eVFX = EffectVisualEffect(VFX_FNF_STRIKE_HOLY);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, GetLocation(oPC));
}
}
Modifié par Sadira of Tyr, 27 janvier 2013 - 11:32 .