Hard to put a headline that describes what I’m trying to do here but…
The scenario is this in broad strokes: The PC gets teleported to a new area. He can be wherever in the world when this happens. All of the companions in the party will remain in the area that he was in. The other companions that are available in the roster will have to be removed completely, so that the player can’t add them in the new area through the Roster Roster/Party Select system that I use. I have received a great include script from @kevL_s that takes care of storing the area where the PC was and storing companions in the roster etc. So that’s no problem.
Now, the issue is when the PC comes back to where he left, I would want a conversation starting right away that adds the companions that were previously in the party, as well as add those to the roster that are not, but were in the roster.
The difficult part I realized now is: How do I trigger this conversation directly when the PC returns to the area where he was before? Do I have to (I would rather not) put some kind of GetGlobalInt on every ClientEnter of every area in the whole module (quite a lot of areas in this module) to run this conversation? Or could you maybe somehow add a GetModule thing where when the PC returns to wherever he is, the conversation automatically starts? Some kind of “This script starts automatically when the PC returns to where he was”?
EDIT: Here’s the script that runs when the PC is to return to the area he was in previously. Could one add to this script that a conversation is somehow run after the PC arriving in the return-area?
//New functions by kevL_s. The rest of the script by andgalf.
void SetSavedLocation(string sVar, object oObject)
{
object oModule = GetModule();
string sArea = GetTag(GetArea(oObject));
SetLocalString(oModule, sVar + "_area", sArea);
float fFace = GetFacing(oObject);
SetLocalFloat(oModule, sVar + "_face", fFace);
vector vObject = GetPosition(oObject);
SetLocalFloat(oModule, sVar + "_x", vObject.x);
SetLocalFloat(oModule, sVar + "_y", vObject.y);
SetLocalFloat(oModule, sVar + "_z", vObject.z);
}
//
location GetSavedLocation(string sVar)
{
object oModule = GetModule();
object oArea = GetObjectByTag(GetLocalString(oModule, sVar + "_area"));
float fFace = GetLocalFloat(oModule, sVar + "_face");
float fx = GetLocalFloat(oModule, sVar + "_x");
float fy = GetLocalFloat(oModule, sVar + "_y");
float fz = GetLocalFloat(oModule, sVar + "_z");
vector vObject = Vector(fx, fy, fz);
return Location(oArea, vObject, fFace);
}
void main(string sVar)
{
object oPC = GetFirstPC();
location lLocation = GetSavedLocation(sVar);
object oTarget=GetFirstFactionMember(oPC,FALSE);
while(GetIsObjectValid(oTarget))
{
AssignCommand(oTarget,ClearAllActions());
AssignCommand(oTarget,ActionJumpToLocation(lLocation));
oTarget=GetNextFactionMember(oPC,FALSE);
}
}