well, okay, normally the PC will be exported to a database in Part 1 … except that’d be a HUGE hassle to test, so I suggest we try setting this up (both the export and the import) in Part 3 – which i assume you’re working on at present?
first thing is to choose a name for your unique database. Something that a person has a chance of recognizing if they browse into their /database folder … like “andgalf” or “<my_story_arc>” … “thetempest” for example, or “andgalf_tempest”.
(32-chars Max, alphanumeric or underscores only i suggest (strongly suggest))
Universal Companions has a bunch of stuff we don’t need. So, do it from scratch.
Let’s say you’re working in Part 3 at the point you’re ready for the cameo to start. Let’s rig up some temporary way to export the current PC (and use that same PC to star in the cameo … yes, a doppleganger, but only for now).
So, uh, i don’t know it’s your preference: place a trigger to run the PC-export script, or use the OnAreaEnter event, or whatever you choose. It’s just a temporary thing(!)
then try these …
The EXPORT script
// 'db_exportpc'
const string DATABASE = "andgalf";
const string CAMEO = "pcpart3cameo";
void main()
{
object oPC = GetFirstPC(TRUE); // get owned character
SendMessageToPC(GetFirstPC(FALSE), "Export " + GetName(oPC));
int bSuccess = StoreCampaignObject(DATABASE, CAMEO, oPC);
if (!bSuccess) SendMessageToPC(GetFirstPC(FALSE), ". failed");
}
The IMPORT function (set up another trigger and call this in its OnEnter script, or include it as a function in the script above and call it at the end of main())
const string DATABASE = "andgalf";
const string CAMEO = "pcpart3cameo";
object db_GetCameoChar()
{
SendMessageToPC(GetFirstPC(FALSE), "Import cameo character");
location lWP = GetLocation(GetWaypointByTag("wp_cameochar")); // <- CHANGE as req'd.
object oCameoChar = RetrieveCampaignObject(DATABASE, CAMEO, lWP);
if (GetIsObjectValid(oCameoChar))
{
SendMessageToPC(GetFirstPC(FALSE), ". success");
SetScriptHidden(oCameoChar, TRUE); // prevent a fade-in/fade-out quickie.
ChangeToStandardFaction(oCameoChar, STANDARD_FACTION_COMMONER); // <- change as you like.
SetCreatureScriptsToSet(oCameoChar, SCRIPTSET_NPC_DEFAULT); // <- give it default AI.
SetPlotFlag(oCameoChar, FALSE);
SetImmortal(oCameoChar, FALSE);
AssignCommand(oCameoChar, SetIsDestroyable(TRUE, FALSE, FALSE));
// anything else?
SetFirstName(oCameoChar, GetFirstName(oCameoChar) + " dopple"); // <- just to distinguish it from the TruePC
DelayCommand(0.f, SetScriptHidden(oCameoChar, FALSE));
return oCameoChar;
}
return OBJECT_INVALID;
}