• 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!

Soldiers remain in Personal uniform after Bridgetown recapture

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
In order to rescue Clement Aurentius, you capture Bridgetown for yourself. All the soldiers are now in Personal uniform. Silehard sends his squadron to take the town back, you defeat the squadron, then while you're at the lighthouse talking to Clement, Britain retakes Bridgetown anyway. So next time you visit Bridgetown, the soldiers are... still in Personal uniform.

The reason is that the capture involves a call on 'SetTownGarrisonForNation'. This goes through every character in the game, looking for any whose location is related to the town in question. If the character isn't an ally, as defined by boolen function 'bAllies', and the character is a soldier in uniform, then he's given the uniform of a soldier of the nation and put in AI group relevant to soldiers of that nation.

The AI group for "Personal" soldiers is LAI_GROUP_PLAYER. One of the conditions for 'bAllies' is if the character is in LAI_GROUP_PLAYER. So 'SetTownGarrisonForNation' skips all the "Personal" soldiers, therefore they remain "Personal" when Bridgetown becomes British.

This is only a problem if a town has become "Personal" and is then captured by a nation, and as there's currently no mechanism for enemy nations to attack your (or anybody else's) towns, the only time a "Personal" town can be captured by a nation is if a storyline makes it happen. So, as a quick fix, I've added a whole lot of lines like this to "quests_reaction.c", quest case "Story_VoyageToKhaelRoaBegan":
Code:
LAi_group_MoveCharacter(characterFromID("Green_soldier_1"), "ENGLAND_SOLDIERS");
One for each soldier in Bridgetown. There are rather a lot. :D But at least doing it this way means there are no odd side effects, as there might be if I try to change 'SetTownGarrisonForNation' or 'bAllies'.

Incidentally, having "Personal" soldiers in LAI_GROUP_PLAYER does have odd side effects. Normally if you try to mug a soldier, all his mates join in against you, and if you kill one, two more arrive to take his place. That's to prevent you from helping yourself to free soldier weapons. But you can't harm anyone in LAI_GROUP_PLAYER, so he just stands there and lets you do what you like to him, and none of the other soldiers react. LAI_GROUP_PLAYER isn't immune to poison, so you hit him with a borgiablade and wait. He drops dead, you steal his stuff, and nobody gets upset. (I've still to see if the soldiers will join in if a random thug tries to attack you because it hasn't happened while Bridgetown was "Personal".)
 
The reason is that the capture involves a call on 'SetTownGarrisonForNation'. This goes through every character in the game, looking for any whose location is related to the town in question. If the character isn't an ally, as defined by boolen function 'bAllies', and the character is a soldier in uniform, then he's given the uniform of a soldier of the nation and put in AI group relevant to soldiers of that nation.

The AI group for "Personal" soldiers is LAI_GROUP_PLAYER. One of the conditions for 'bAllies' is if the character is in LAI_GROUP_PLAYER. So 'SetTownGarrisonForNation' skips all the "Personal" soldiers, therefore they remain "Personal" when Bridgetown becomes British.
That's... yeah... Oops...? :facepalm

I can't really think of any clever all-round fix, unless we can somehow ensure that characters in the REAL player party NEVER have the "isSoldier" attribute, but regular town guards/patrols do.
But that would require a fair bit of fiddling around to ensure there are no new crazy side-effects, so your suggestion does sound like the safest short-term solution. :onya

Incidentally, having "Personal" soldiers in LAI_GROUP_PLAYER does have odd side effects. Normally if you try to mug a soldier, all his mates join in against you, and if you kill one, two more arrive to take his place. That's to prevent you from helping yourself to free soldier weapons. But you can't harm anyone in LAI_GROUP_PLAYER, so he just stands there and lets you do what you like to him, and none of the other soldiers react. LAI_GROUP_PLAYER isn't immune to poison, so you hit him with a borgiablade and wait. He drops dead, you steal his stuff, and nobody gets upset.
Perhaps the easiest way to "fix" that is to also make them immune to poison, but that could make "stink pots during boarding" perhaps a bit too effective.
On the other hand, this doesn't sound like too huge an exploit, so maybe it's fine as-is.

I've still to see if the soldiers will join in if a random thug tries to attack you because it hasn't happened while Bridgetown was "Personal".
I think that used to work better in older modpack versions.
You can talk with citizens in houses to bribe the town guards to help you against thugs.
But I don't think that really works anymore either... :(

(!!!STUPID AI GROUP RELATIONS CODE!!! :whipa )
 
That's... yeah... Oops...? :facepalm

I can't really think of any clever all-round fix, unless we can somehow ensure that characters in the REAL player party NEVER have the "isSoldier" attribute, but regular town guards/patrols do.
But that would require a fair bit of fiddling around to ensure there are no new crazy side-effects, so your suggestion does sound like the safest short-term solution. :onya
The root cause of the problem seems to be that 'bAllies' is true if the character is in LAI_GROUP_PLAYER, coupled with the AI group for "Personal" soldiers being LAI_GROUP_PLAYER. 'bAllies' needs to allow for LAI_GROUP_PLAYER in case a quest has attached some NPC's to the group, typically because you're in a battle on the side of those NPC's - for example, in "Tales of a Sea Hawk", when you land Ewan Glover's troops on the beach and have to fight some French soldiers. The British soldiers go into LAI_GROUP_PLAYER so that the AI doesn't get confused about who is supposed to be attacking whom - the French will attack the British and you, the British won't attack you. The British soldiers are therefore allies.

So, try for the other side of the problem - perhaps "Personal" soldiers need a separate AI group? That would certainly solve both issues - 'SetTownGarrisonForNation' wouldn't ignore them and they'd react the same way as any other soldiers if you try to steal their stuff. I don't know if it would mess anything else up, though.
 
So, try for the other side of the problem - perhaps "Personal" soldiers need a separate AI group? That would certainly solve both issues - 'SetTownGarrisonForNation' wouldn't ignore them and they'd react the same way as any other soldiers if you try to steal their stuff. I don't know if it would mess anything else up, though.
There is definitely sense in that... :rolleyes:
 
Back
Top