If you want to look at some relevant code, it is all in PROGRAM\Screwface_functions.c .
Specifically this spot:
That is where an NPC starts to remember what nation you belong to (specifically what flag you were flying when you were spotted).
And this function that gets called when your false flag is recognized:
The spots where .PlayerNation and .recognized are set to 1 is where the timer has to be started for that specific character.
Then when the timer expires, this function from PROGRAM\NATIONS\nations.c should be called for that specific character:
So we know where to start it and we know where it should lead. We also know mostly how to get there.
It can't be "Pchar.quest.start_countdown", but has to be "NPchar.quest.start_countdown".
And then the next quest case that gets called needs to be called for that same NPC.
So the character ID that it applies to needs to be maintained through several quest cases.
Should be possible. I just haven't thought of exactly how yet.
Specifically this spot:
Code:
chr.PlayerNation = iNation;
Trace("FLAGS: The " + GetMyShipNameShow(chr) + " has spotted us at " + ship_range + " and will remember us as " + GetNationDescByType(iNation) + " with visibility=" + visibility_range);
And this function that gets called when your false flag is recognized:
Code:
void SetGroupHostile(ref chr, bool bBetrayed)
{
int i, num, otherChar;
string sGroupID = GetGroupIDFromCharacter(chr);
if (sGroupID == "") // For forts and other ships that may not be in any group
{
chr.recognized = 1;
if (bBetrayed) chr.betrayed = 1;
}
else
{
ref rGroup = Group_GetGroupByID(sGroupID);
num = Group_GetCharactersNumR(rGroup);
for (i = 0; i < num; i++)
{
otherChar = Group_GetCharacterIndexR(rGroup, i);
characters[otherChar].recognized = 1;
if (bBetrayed) characters[otherChar].betrayed = 1;
}
Group_SetTaskAttack(sGroupID, PLAYER_GROUP, false); // False to skip call to SetCharacterRelationBoth!
}
}
The spots where .PlayerNation and .recognized are set to 1 is where the timer has to be started for that specific character.
Then when the timer expires, this function from PROGRAM\NATIONS\nations.c should be called for that specific character:
Code:
void ResetCharacterMemory(ref chr)
{
DeleteAttribute(chr,"recognized");
DeleteAttribute(chr,"betrayed");
DeleteAttribute(chr,"PlayerNation");
DeleteAttribute(chr,"relation_to_pirates");
}
So we know where to start it and we know where it should lead. We also know mostly how to get there.
The main thing I am wondering about is how to make that work for a whole bunch of NPCs individually.First have a quest case which detects that you're on the worldmap, triggered like this:Then quest case "start_countdown" is your one with the expiry date.Code:Pchar.quest.start_countdown.win_condition.l1 = "MapEnter"; Pchar.quest.start_countdown.win_condition = "start_countdown";
It can't be "Pchar.quest.start_countdown", but has to be "NPchar.quest.start_countdown".
And then the next quest case that gets called needs to be called for that same NPC.
So the character ID that it applies to needs to be maintained through several quest cases.
Should be possible. I just haven't thought of exactly how yet.
GetCharacterShipID(ref char) is the safest way of doing that.I don't know where or how you'd check if the player's ship is the stored one, but the basic logic would be something like this:I'm not sure off-hand how to get <player's ship> or <companion ship(n)>, but presumably there is a function to find what type of ship is used by the player or in any given companion slot. <stored ship> will have been copied from <player's ship> at some point where the fort is remembering you.Code:if (<player's ship> == <stored ship>) return true; for (n=1; n<4; n++) {if (companion ship(n) == <stored ship>) return true;} return false;