How is ServedNation defined? Presumably initially it's whatever nation you pick (or are assigned, if you choose a specific named character or are playing a storyline). If you buy a LoM from another nation, does ServedNation then change? What happens at each stage of the following sequence:
1. Start off a free-play character at a British colony. (Presumably ServedNation is Britain?)
2. Buy a French LoM. (Now ServedNation is France?)
3. Tell a French governor that you no longer serve France. (So currently you serve no nation - are you now PERSONAL_NATION, still French, or revert to British?)
4. Buy a Dutch LoM. (Presumably ServedNation is now Holland?)
5. Buy a Spanish LoM as well. (Presumably you now become PERSONAL_NATION as you have two LoM's.)
6. Tell a Dutch governor that you no longer serve Holland, so you now only have one LoM. (Spanish, so do you remain PERSONAL_NATION or does ServedNation become Spain?)
What happens if you actively betray your ServedNation, e.g. start off as British and then start sinking British ships without a LoM from a hostile power? Perhaps that ought to make ServedNation become Pirate. So should hoisting Pirate flag. And once ServedNation is Pirate, there's no going back. (It would be too easy if all you need to do is crave forgiveness from one nation, buy a LoM to make that your ServedNation, and automatically get free forgiveness from anyone allied or neutral to that nation.)
I have done some serious thinking of this in the train today and have come up with a system that appears to work.
Original code:
Code:
void SetServedNation(int iNation)
{
ref PChar = GetMainCharacter();
PChar.ServedNation = iNation; // PB: Make sure this sticks
}
int GetServedNation()
{
ref PChar = GetMainCharacter();
if(!CheckAttribute(PChar, "ServedNation"))
PChar.ServedNation = PERSONAL_NATION; // PB: Don't serve anyone until you get a LoM (prevents missed attribute error)
return sti(PChar.ServedNation); // PB: Make sure this sticks
}
New code:
Code:
void SetServedNation(int iNation)
{
ref PChar = GetMainCharacter();
int NumLoMs = 0; // Count number of LoMs
bool BecomePirate = iNation == PIRATE; // Enforce becoming a pirate upon joining them
for (int i=0; i<NATIONS_QUANTITY; i++) // Check all nations
{
if (HaveLetterOfMarque(i)) // If you have a LoM
{
NumLoMs = NumLoMs + 1; // Add one to the counter
iNation = i; // Set served nation to THIS instead
if (i == PIRATE) BecomePirate = true; // If you once joined the pirates, you remain a pirate even if you have another LoM
}
}
if (BecomePirate) iNation = PIRATE; // Make sure you remain a pirate if appropriate
else
{
if (NumLoMs > 1) iNation = PERSONAL_NATION; // If you have multiple LoMs, you don't serve any specific nation
}
PChar.ServedNation = iNation; // Make sure this sticks
TraceAndLog("Player now serves " + GetNationDescByType(iNation));
}
int GetServedNation()
{
ref PChar = GetMainCharacter();
if(!CheckAttribute(PChar, "ServedNation"))
PChar.ServedNation = PERSONAL_NATION; // Don't serve anyone until you get a LoM (prevents missed attribute error)
return sti(PChar.ServedNation); // Make sure this sticks
}
Additionally, the following additional calls are added:
- SetServedNation(iNation) when you get a LoM
- SetServedNation(PERSONAL_NATION) when you leave a nation's service on GOOD terms
- SetServedNation(PIRATE) when you leave a nation's service on BAD terms
This means that:
- If you serve the pirates, GetServedNation always returns PIRATE even if you have other LoMs
- If you have multiple LoMs, then GetServedNation returns PERSONAL_NATION (unless you're a pirate)
As for your sequence of events:
1. Start as English character, so Served Nation = ENGLAND
2. Buy a French LoM, Served Nation changes to FRANCE (because you didn't have an English LoM)
3. Leave service of France on good terms, Served Nation changes to PERSONAL_NATION
4. Buy a Dutch LoM, Served Nation = HOLLAND (because you had no LoMs left)
5. Buy a Spanish LoM, Served Nation = PERSONAL_NATION (because this is your second LoM)
6. Leave service of Holland on good terms, Served Nation changes to Spain (because that is your only LoM)
Throwing some pirating in there:
7. Buy a Dutch LoM again, Served Nation = PERSONAL_NATION (because this is your second one again)
8. Leave service of Spain on BAD terms, Served Nation = PIRATE (because bad terms,
not HOLLAND because pirate takes precedence over LoMs)
9. Buy a French loM again, Served Nation = PERSONAL_NATION (now Dutch + French LoM and didn't truly serve PIRATE)
10. Join pirates, Served Nation = PIRATE
11. Get whatever other LoMs you want, Served Nation remains PIRATE
12. Leave pirates on good terms, Served Nation back to PERSONAL_NATION
or
12. Leave pirates on BAD terms, Served Nation remains PIRATE
13. Get another LoM, Served Nation back to PERSONAL_NATION (because you didn't truly serve PIRATE anymore)
Does any of that make sense?
Note that at the moment it doesn't matter at all if you serve PIRATE or PERSONAL_NATION because in both cases your relations don't change when other nations' relations change.
However, if we make further use of this in the future, then this might become more important of course.