• 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 Auto-hoist French flag in "Tales of a Sea Hawk"

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
First mission for Silehard: reconnoitre Speightstown. I sail to Bridgetown, intending to walk from there to Speightstown, visiting the cave on the way. All goes according to plan. I leave the cave with a nice new sword (alright, not exactly new, it's a bit dull at the moment), proceed to Speightstown, persuade the French officer to tell me all about the ammo ship, and return to Bridgetown. Then I put to sea and am blasted out of the water by the fort because someone thought it a good idea to raise a French flag.

And I can't see in the code where it's done.

But it's a silly idea. Either you arrived at Speightstown somewhere where you need a false French flag, e.g. in Speightstown itself or at a nearby beach where the blockading French fleet can see you; or you landed somewhere which doesn't need a French flag, e.g. a more distant beach or at Bridgetown. So either you already have a French flag up or you don't need it at all.
 
There must be some code in place to deliberately do that.

Are you able to play through that section again without too much trouble?
The most straightforward way of finding out would be to play through again, check F2>Nations Relations once in a while and, as soon as it changes, check compile.log to see what quest cases were executed last.
The culprit must be either in those quest cases or in the dialog files you just went through.

Note that HoistFlag(FRANCE); would have this effect, but setting pchar.nation = FRANCE; would do it too.
(PChar.nation is your flag and has nothing at all to do with your original nationality.)
 
Matters aren't helped by only being able to change flag while aboard ship, of course. ;) But there is a workround - board your ship by going to deck, not straight to sea, then you can change to British flag and continue to sea.

Of course, first you need to know that the flag needs to be changed, which you find out when you first put to sea and the fort attacks you. Anyone who doesn't do what I do, which is save game every time I'm on the dock and about to put to sea, is going to have a harder time of it.
 
Matters aren't helped by only being able to change flag while aboard ship, of course. ;)
You know the only reason I made that change is as a test to obtain feedback, right?
We had a poll on it at the time, which wasn't entirely a landslide: Included in Build - Modify "False Flag" Behaviour While Ashore | PiratesAhoy!
So if you have any feedback on whether that is actually a good idea or not, POST IT THERE!
Changing this is extremely easy. I just need to know what it is that we want.

But there is a workround - board your ship by going to deck, not straight to sea, then you can change to British flag and continue to sea.
That part is very much intentional. You have to be able to change your flag somewhere, right? :cheeky

Of course, first you need to know that the flag needs to be changed, which you find out when you first put to sea and the fort attacks you.
OR you can check the F2>Nations Relations interface. Even when you cannot change flag, you can still see which one you are currently flying.
That is not prevented. :no
 
You can indeed check your current flag at any time with the Nations Relations interface, if you know there's a chance that it has been changed without you being told about it. But if you land somewhere with the flag set the way you want it, then wander around on land a while, you tend to assume that the flag will be the same way you left it when you return. Unless, of course, you've been caught out by a storyline which changes your flag to a hostile one to the port you're in, and are now paranoid and check the flag every few minutes. This does not make for good gameplay. ;)

The basic problem is, where in the storyline code is the flag changed, and can it be prevented? (I can't find any signs of 'PChar.nation = FRANCE' either.)
 
You can indeed check your current flag at any time with the Nations Relations interface, if you know there's a chance that it has been changed without you being told about it. But if you land somewhere with the flag set the way you want it, then wander around on land a while, you tend to assume that the flag will be the same way you left it when you return. Unless, of course, you've been caught out by a storyline which changes your flag to a hostile one to the port you're in, and are now paranoid and check the flag every few minutes. This does not make for good gameplay. ;)
I understand that perfectly well.
Point though is that it DOES get changed and we don't know why. What I described is the only straightforward way I can think of to narrow it down.
What I said isn't a proposed "solution"; it is a proposed way of tracking down the culprit.
Obviously this should not be required in general gameplay and is purely a testing method.

The basic problem is, where in the storyline code is the flag changed, and can it be prevented? (I can't find any signs of 'PChar.nation = FRANCE' either.)
That is why I suggested what I suggested; hopefully that would allow finding where it happens.
 
Good point. And indeed, it did. :onya Here's the culprit, in case "Story_Walk_Away_with_Massoni":
Code:
       LAi_type_actor_Reset(characterFromID("Valentin Massoni"));

       SafePortLeave(GetCurrentLocationNation(), false); // KK <----  Guilty!

       LAi_ActorGoToLocator(characterFromID("Valentin Massoni"), "Goto", "citizen018", "Story_Massoni_go_walking", 50.0);
Your current location at that point is the jungle exit from Speightstown, which presumably is French. "SafePortLeave" takes two arguments, the nation you're trying to safely leave and a boolean override. If you're hostile to the nation or the boolean override is true, it hoists that nation's flag and sets "iForceDetectionFalseFlag" to -1. The upshot is that the moment you walk out of Speightstown with Valentin Massoni, your flag changes to French.

It might make more sense to check your ship's location rather than your location, if that's possible. You'll almost certainly have a false French flag already if you moored somewhere French, e.g. in Speightstown itself or at a beach close by, so the only effect of this would be to set "iForceDetectionFalseFlag" and make sure the false flag is believed. If you're moored somewhere British, e.g. Bridgetown, and if this were made to check the ship's location, then nothing would happen.

Alternatively just remove or comment out that line and let anyone who moored somewhere dangerous take their chances with their false flag. Serves them right for being lazy and not walking from Bridgetown. xD
 
Good catch!
Indeed that function is meant to help you to not get sunk on sight; not the exact opposite!
But I can imagine indeed situations where it would be a hindrance rather than a help.

If checking ship location makes sense to you, there is absolutely a function that will tell you that.
Can't remember by the top of my head and I don't have access to my game files for a while, but it definitely exists.

An addition could even be made to check if your ship is in a port at all; after all, for a shore anchorage, it might as well be skipped too.
 
That depends on how far the blockade ships are from the nearest beach to Speightstown. (Which, I believe, is called Far Beach. xD). But even checking a beach makes more sense than checking a jungle location, which is what's checked at the moment.
 
I think there is something called CharacterShipLocation or something similar.

If you think excluding beaches is a good idea, I think you can do that with if (!HasSubStr (ship_location, "port") return; or something like that.
That should be quite safe, because each actual port location MUST have "port" in its ID, otherwise the Escort quests there would fail.
We had an issue with Eleuthera ages ago, which is why I know that.
 
Thanks! I've added that to my version of "quests_reaction.c", commenting out the original line which it replaces.
 
Thanks! I've added that to my version of "quests_reaction.c", commenting out the original line which it replaces.
Cool! If you could include any fixes to the Standard Storyline with your upcoming Ardent update, that would be great! :cheers

Also... you may want to double-check that actually does what we think it does.
I didn't test it myself at all.
 
As I may have mentioned, what I'll be testing for a while is "Ardent". ;) But there seem to be one or two people playing "Tales of a Sea Hawk", so presumably we'll soon find out if this fix makes the problem worse, solves it or does nothing...

The "Ardent" update is likely to need to go on the FTP site. The "Standard" update is still small enough to be posted here. I'll put up what I have today some time, then hopefully release "Ardent" on Monday after a weekend's worth of testing.
 
@Grey Roger: I found the "quest attribute deleting code" that I was referring to in quests.c:
Code:
void OnQuestComplete(aref quest)
{
   if(!CheckAttribute(quest,"over") && CheckAttribute(quest,"win_condition"))
   {
     if(quest.win_condition == "_") return;
     quest.over = "yes";
And:
Code:
void QuestsCheck()
{
[...]
   for(n = 0; n < GetAttributesNum(quests); n++)
   {
     quest = GetAttributeN(quests,n);
     if(CheckAttribute(quest,"over") && quest.over=="yes")
     {
       // delete quests already completed or failed
       DeleteAttribute(quests,GetAttributeName(quest));
       n--;
     }
   }
   bQuestCheckProcess = false;
}
If I understand that correctly, it means that completed quest attributes get deleted on the NEXT update.
Which means you should indeed be OK with the way you use it there. :onya
 
Back
Top