• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fixed Tales of a Sea Hawk: some guards remain Personal after Bridgetown is recaptured

I can't remember what adds the "betrayed" attribute again, but the fort capture did not check for that yet.
That's the odd thing. That savegame in which I'm about to talk to the soldier and take over Bridgetown was made after I'd bombarded the fort under a Dutch flag, and at this point I'm not yet a pirate. It is talking to the soldier and capturing the town which turns me pirate - or not, if "quests_reaction.c" has been changed to use 'CaptureTownForNation' instead of 'CaptureColony', or if your new "Dialog_func.c" is in place and a 'skipRM' line is added to "quests_reaction.c".

So what if we just use the regular 'UpdateRMRelation' call instead?
In other words: You won't get plus points when looting a colony from any nation, EXCEPT those you already have a LoM from.

Should you get plus points for looting a colony at all? Definitely for capturing it and giving it to another nation.
But with looting, it is YOU who gets the main bonus. Why should random nations "reward" you for you enriching yourself?
If you have a LoM then definitely, for the same reason as they reward you for taking an enemy ship - you've just hurt an enemy. The fact that you got rich in the process doesn't matter, any more than the fact that you can make lots of money by capturing and auctioning an enemy merchant ship loaded with gold.

As for other nations - you've just demonstrated that you're capable of attacking a colony. Speaking on behalf of the governor of a colony, I'd rather like to encourage you to keep on attacking someone else's colonies and leave mine alone! Perhaps limit the boost to only happen if you took a colony with a fort, because it's relatively easy to plunder any of the unfortified pirate colonies (though the governor of Oranjestad would probably also like you to continue attacking those rather than his colony). And, of course, there's again the factor that you've hurt an enemy, a lot more seriously than by just taking a few of that enemy's ships.
 
That's the odd thing. [...] It is talking to the soldier and capturing the town which turns me pirate
That is not really strange. All the nation relation updates are done as part of the call to 'CaptureColony'. So until that happens, there are no consequences.
This is also how there are zero consequences if you have a sea battle with what should be friend, but decide to escape rather than sink/capture that ship.
Both ways, the actual 'UpdateRMRelation' function never gets called, because it is only done at the very end.

That savegame in which I'm about to talk to the soldier and take over Bridgetown was made after I'd bombarded the fort under a Dutch flag, and at this point I'm not yet a pirate.
If you were still flying a Dutch flag at the time that you talked to the soldier, then that would definitely trigger the "betrayed" behaviour.
But if you changed flags before that, it should not have happened. Until now.

Perhaps limit the boost to only happen if you took a colony with a fort, because it's relatively easy to plunder any of the unfortified pirate colonies (though the governor of Oranjestad would probably also like you to continue attacking those rather than his colony).
You cannot do that from the start of the game anymore though; you'll progress a fair bit before you can do that now, right?

Is there a simple way to check for the presence of a fort? Might be possible....

As for other nations - you've just demonstrated that you're capable of attacking a colony. [...] And, of course, there's again the factor that you've hurt an enemy, a lot more seriously than by just taking a few of that enemy's ships.
But how do we prevent that from getting exploit-ey?
And since you're attacking towns anyway, how do the other nations (who are hostile to you) know that you aren't next on their list?
Maybe add those plus points only for nations that aren't hostile? So then at least they pretty much know they aren't going to be your next target?
 
You cannot do that from the start of the game anymore though; you'll progress a fair bit before you can do that now, right?
You'll also progress a fair bit before you can take a fort. Raiding an unfortified colony requires the "Landing Party" perk, alias "Troopers", which requires either level 20 or a first mate who already has it. Raiding a fort requires a powerful ship which means either you're high enough rank and rich enough to buy it, or you're powerful enough to have taken it from someone else.

But how do we prevent that from getting exploit-ey?
And since you're attacking towns anyway, how do the other nations (who are hostile to you) know that you aren't next on their list?
That's exactly their worry! And that's why they don't want to be hostile to you any more. ;)

Also, note that this only works if they're borderline hostile. You won't repair your relations with Britain by raiding one pirate colony if you've also been looting British ships and they're now down to -70. You'd have to stop raiding British ships and start hitting pirate bases regularly, which would no doubt make the British governors very happy. This, by the way, may be why the replacement governor of Port Royale offers you a pardon, reinstatement of rank if you previously had one, and some money. You're now in possession of both the Sovereign of the Seas and the Black Pearl, and he'd much rather have you as a friend than as an enemy!

Meanwhile, any more thoughts about the original problem of this thread, which is why some but not all of Bridgetown's guards remain in Personal uniform after Britain takes the town back?
 
Meanwhile, any more thoughts about the original problem of this thread, which is why some but not all of Bridgetown's guards remain in Personal uniform after Britain takes the town back?
My very strong suspicion is that it is because of this here:
However, I think I found the culprit and I recognize the initials there (yes, they're mine...):
Code:
trace("SetTownGarrisonForNation: town="+town+", 1st="+bFirstInit);

for (n = 0; n < CHARACTERS_QUANTITY; n++) {
character = GetCharacter(n);
if (CheckAttribute(character, "location") == false || FindLocation(character.location) < 0 || GetTownGovernorIndex(town) == n || IsOfficer(character) == true) continue;
if (GetTownIDFromLocID(character.location) == town) {
if (bAllies(character)) continue; // PB: Skip any characters that are with the player
If I recall, the reason for that 'bAllies' check is to avoid any characters belonging to the player party from getting their nationality changed.
But of course those Personal Soldiers ARE in the Player Party and are therefore being skipped too, which is NOT intentional.

I'm not entirely sure of the safest way to fix this, but at least we now know why it happens.

I am also failing to see where the town characters get their actual .nation attribute changed.
As far as I can tell now, that never does actually happen. Which makes me wonder why I had to bother to put that "tailor" exception in place.
Probably if you comment out that 'bAllies' line, then call 'CaptureTownForNation' again, they'll all revert back.
Could you test that to see if that is indeed the case?

That's exactly their worry! And that's why they don't want to be hostile to you any more. ;)

Also, note that this only works if they're borderline hostile. You won't repair your relations with Britain by raiding one pirate colony if you've also been looting British ships and they're now down to -70. You'd have to stop raiding British ships and start hitting pirate bases regularly, which would no doubt make the British governors very happy. This, by the way, may be why the replacement governor of Port Royale offers you a pardon, reinstatement of rank if you previously had one, and some money. You're now in possession of both the Sovereign of the Seas and the Black Pearl, and he'd much rather have you as a friend than as an enemy!
Hmm.... I'm still a bit on the fence on this one, but I suppose it might actually be OK.
 
My very strong suspicion is that it is because of this here:

Probably if you comment out that 'bAllies' line, then call 'CaptureTownForNation' again, they'll all revert back.
Could you test that to see if that is indeed the case?
OK, I'll try that next time I have a chance to play it. I'll amend "Towntable.c" to comment out that line, then load up the savegame, talk to the soldier to take the colony for Personal, then see what happens from there.

I noticed this in "Dialog_func.c" in the definition of 'CaptureColony':
Code:
   bool tmpbool = toNation >= 0 || toNation < NATIONS_QUANTITY;

   tmpbool = tmpbool || toNation == PERSONAL_NATION;
   if (!tmpbool || !TownExist(TownName)) return;
Should the first line perhaps have '&&' instead of '||'? I'm guessing this is a check that "toNation" is a valid value, i.e. somewhere between 0 and "NATIONS_QUANTITY"; but this would set "tmpbool" if "toNation" is over 0 or less than "NATIONS_QUANTITY", which it certainly will be if "NATIONS_QUANTITY" is itself greater than 0. (The code then checks if "toNation" is "PERSONAL_NATION", which is -1 and should have failed the first check, then quits if either "tmpbool" is false or the town doesn't exist. So only proceed if you're trying to capture a valid town for a valid nation.)
 
I noticed this in "Dialog_func.c" in the definition of 'CaptureColony':
Code:
bool tmpbool = toNation >= 0 || toNation < NATIONS_QUANTITY;

tmpbool = tmpbool || toNation == PERSONAL_NATION;
if (!tmpbool || !TownExist(TownName)) return;
Should the first line perhaps have '&&' instead of '||'?
Yes, I do believe you're correct.

I don't imagine I'll have time myself today or tomorrow for corrections to this and after that I'll be away for over two weeks.
Could you put all your suggested corrections in your own game version and then upload them together in a week or two?
 
to ensure that all Bridgetown guards change into Personal uniform when you take the town and then all change back to British uniform when Britain retakes the town.
Did you manage to fix that properly then? :woot

I do wonder if removing that 'bAllies' check altogether might not cause any unintended side-effects.
While officers are protected from changing, I don't think any Shore Crewmembers are so they might get their nationality changed as well.
Same for player BuildingSet structures that happen to be around.
 
Yes, I do believe you're correct.

I don't imagine I'll have time myself today or tomorrow for corrections to this and after that I'll be away for over two weeks.
Could you put all your suggested corrections in your own game version and then upload them together in a week or two?
Done. Admittedly the game version I'm using for "Tales of a Sea Hawk" is mostly the 18th June version, but I used the 28th July version as a source for "Towntable.c" before making your suggested change, and "Dialog_func.c" is the one you uploaded above.

I tested it by using the console to give myself a "Colonial Powers" British soldier outfit and then putting it on one of my officers. Then I reloaded the usual savegame, captured Bridgetown, refought the counterattack battle, and went to La Grenade Smugglers Camp to buy myself amnesty from Britain so I could safely return to Bridgetown without having to first replay the whole Cozumel finale. And this time all the guards were indeed back in British uniform. My officer remained in British uniform throughout the whole thing.

Which, thinking about it, is no surprise. Your party won't be affected by a town being captured for PERSONAL_NATION because they're not in the group being changed. And they won't be affected by a town being taken from PERSONAL_NATION because you and they won't be there when it happens. At present the only time I know of a Personal town being captured by someone else is in "Tales of a Sea Hawk", and you're at the lighthouse at the time.
 
Did you manage to fix that properly then? :woot

I do wonder if removing that 'bAllies' check altogether might not cause any unintended side-effects.
While officers are protected from changing, I don't think any Shore Crewmembers are so they might get their nationality changed as well.
Same for player BuildingSet structures that happen to be around.
Shore crewmembers shouldn't be an issue because, again, you won't be in town when it's captured. BuildingSet structures should change nationality - if you've built something in town and the town is then captured, the captors get to take over your structure as well. Presumably if you recapture the town for yourself, you get the structure back.

There is one possible problem which I'll need to check some time, though, and that's if you have ships berthed in the town which just changed hands. Though if officers are protected from changing then they ought to be safe.
 
Shore crewmembers shouldn't be an issue because, again, you won't be in town when it's captured.
At the moment that is indeed true. But what if we start using it in other situations as well?

BuildingSet structures should change nationality - if you've built something in town and the town is then captured, the captors get to take over your structure as well. Presumably if you recapture the town for yourself, you get the structure back.
I suppose that does indeed make sense. But if you personally make a structure in an English town, then it is yours, not England's.
Perhaps then the "invaders" are less considerate and just take everything for themselves?

I'm not even sure what is and isn't affected here; it would need to be tested to be certain.

Though if officers are protected from changing then they ought to be safe.
Officers are protected by this check:
Code:
if (CheckAttribute(character, "location") == false || FindLocation(character.location) < 0 || GetTownGovernorIndex(town) == n || IsOfficer(character) == true) continue;
Specifically the 'IsOfficer' part. That is true only for your Shore Party officers though.
This is why I originally added that 'bAllies' check to exclude ALL characters affiliated with the player.
But of course any soldiers should NOT be excluded like that.

Maybe this would be a better idea?
Code:
void SetTownGarrisonForNation(string town, int iNation)
{
 int n;
 bool chknation = iNation >= 0 && iNation < NATIONS_QUANTITY;
[...]
 if (CheckAttribute(character, "location") == false || FindLocation(character.location) < 0 || GetTownGovernorIndex(town) == n || IsOfficer(character) == true) continue;
 if (GetTownIDFromLocID(character.location) == town) {
 if (GetAttribute(character, "Dialog.Filename") != "tailor_dialog.c" || iNation != PERSONAL_NATION) character.nation = iNation; // PB: Skip tailor nation change when taking town for yourself
 if (isSoldier(character) != UNKNOWN_NATION) {
[...]
 } else {
  if (bAllies(character)) continue; // PB: Skip any characters that are with the player
 if (iNation != PERSONAL_NATION) {
 
At the moment that is indeed true. But what if we start using it in other situations as well?
If that happens then presumably someone will report a bug in those situations. This report was about "Tales of a Sea Hawk" and the problem appears to be solved there. :D

I suppose that does indeed make sense. But if you personally make a structure in an English town, then it is yours, not England's.
Perhaps then the "invaders" are less considerate and just take everything for themselves?
Of course. They're taking the rest of your town, why wouldn't they take all the structures in it? Likewise, if you capture Bridgetown for yourself, presumably all the added structures such as the newly-added entrance to the fort become yours - and should revert to Britain when Britain retakes the town.

Maybe this would be a better idea?
Code:
void SetTownGarrisonForNation(string town, int iNation)
{
int n;
bool chknation = iNation >= 0 && iNation < NATIONS_QUANTITY;
[...]
if (CheckAttribute(character, "location") == false || FindLocation(character.location) < 0 || GetTownGovernorIndex(town) == n || IsOfficer(character) == true) continue;
if (GetTownIDFromLocID(character.location) == town) {
if (GetAttribute(character, "Dialog.Filename") != "tailor_dialog.c" || iNation != PERSONAL_NATION) character.nation = iNation; // PB: Skip tailor nation change when taking town for yourself
if (isSoldier(character) != UNKNOWN_NATION) {
[...]
} else {
  if (bAllies(character)) continue; // PB: Skip any characters that are with the player
if (iNation != PERSONAL_NATION) {
If you supply a finished version of "Towntable.c" I can test it the usual way. But I really need to finish with "Tales of a Sea Hawk" and get on with my own work...
 
If that happens then presumably someone will report a bug in those situations. This report was about "Tales of a Sea Hawk" and the problem appears to be solved there. :D
True. But if we can avoid future errors in advance, we might as well, right? :rolleyes:

Of course. They're taking the rest of your town, why wouldn't they take all the structures in it? Likewise, if you capture Bridgetown for yourself, presumably all the added structures such as the newly-added entrance to the fort become yours - and should revert to Britain when Britain retakes the town.
For existing structures, it doesn't matter much. But player-built structures allow you to make use of them in various ways.
I'm simply not sure how this goes together with Capture Colonies. May need to be checked some day.

If you supply a finished version of "Towntable.c" I can test it the usual way.
See attached. All I did was to move the 'bAllies' line inside the 'else' for the 'isSoldier' check.
Otherwise the file should be identical to the onew you uploaded before.
 

Attachments

  • Towntable.c
    64.7 KB · Views: 109
Back
Top