RE: [HELP] Saving/Restoring a Persistent Location

Good morning. Yes, I’ve fallen down the PW server rabbit hole again.

Can anyone point me to some basic persistence for a PW that works with the sqlite db now used with EE? I’m looking at just being able to save the PC’s location OnClientLeave and then reload it again in OnClientEnter (or whatever event you use to do it).

I have PRC 3.9.1 installed.

My OnClientLeave event:

void main()
{
    object oPC = GetExitingObject();

    if (!GetIsDM(oPC) )
    {
        SetCampaignLocation("GGS_Server", "LOC_" +GetPCPublicCDKey(oPC), GetLocation(oPC));
    }

    ExecuteScript("prc_onleave", oPC);
}

EDIT - I got it working. I had to put the restore location routine in the OnEnter of the first area.

#include "x0_i0_transport"

void main()
{
    object oPC = GetEnteringObject();

    if (!GetIsDM(oPC) )
    {
        // go to last location
        location lJump = GetCampaignLocation("GGS_Server", "LOC_" +GetPCPublicCDKey(oPC));
        object oArea   = GetObjectByTag(GetCampaignString("GGS_Server", "AREA_" +GetPCPublicCDKey(oPC)));

        if (GetIsObjectValid(oArea) )
        {
            TransportToLocation(oPC, lJump);
        }
    }
}