• 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 Coastguard Ships Remain After Escape

Hylie Pistof

Curmudgeon
QA Tester
Storm Modder
Pirate Legend
The ships that are always there and never go away are a bug.

It is not reasonable to expect the patrols to cover every part of an island all day and all night. Who pays for all those ships and their crews? Who pays for all those soldiers? It is well known that smuggling was common and that means a much smaller military force.
 
The ships that are always there and never go away are a bug.

It is not reasonable to expect the patrols to cover every part of an island all day and all night. Who pays for all those ships and their crews? Who pays for all those soldiers? It is well known that smuggling was common and that means a much smaller military force.
I proposed addressing just that in the summary I posted here: :doff
Medium Priority - Improving the Smuggling System | Page 3 | PiratesAhoy!

As for the ships always being there, as far as I can tell from the code, that shouldn't be happening.
But there are so many variables that it is difficult to tell what code is and isn't being triggered for your encounter.
Using DEBUG_SMUGGLING as I suggested will tell us more and should help a lot in figuring out the correct way of fixing it.
 
Last edited:
Had an idea for addressing the main bug that was reported.
I don't know how or why it got triggered, but I think I DO know a way to prevent it in the future.

Rather than having the "remove them on worldmap enter" triggered in various spots in the code,
I'm moving the call to that quest case to the same spot where the ships are generated in the first place:
Code:
void SetCoastalGuardPursuit()
{
   ref Pchar = GetMainCharacter();
   if(DEBUG_SMUGGLING>2) trace("SMUGGLING move coastguard to the sea");
   Group_SetTaskAttack("Coastal_Guards", PLAYER_GROUP, true);
   Group_LockTask("Coastal_Guards");
   Group_SetPursuitGroup("Coastal_Guards", PLAYER_GROUP);
   Group_SetAddress("Coastal_Guards", Islands[GetCharacterCurrentIsland(Pchar)].id, "", "");
   // PB: Ensure they're deleted after escaping -->
   Pchar.quest.Rand_ContrabandInterruptionAtSeaEnded.win_condition.l1 = "MapEnter";
   Pchar.quest.Rand_ContrabandInterruptionAtSeaEnded.win_condition = "Rand_ContrabandInterruptionAtSeaEnded";
   // PB: Ensure they're deleted after escaping <--
}

void StopCoastalGuardPursuit()
{
   ref Pchar, rCap1, rCap2, rCap3;
   Pchar = GetMainCharacter();
   rCap1 = CharacterFromID("Coastal_Captain01");
   rCap2 = CharacterFromID("Coastal_Captain02");
   rCap3 = CharacterFromID("Coastal_Captain03");

   group_DeleteGroup("Coastal_Guards");
   ChangeCharacterAddressGroup(CharacterFromID("Coastal_Captain01"), "None", "", "");
   ChangeCharacterAddressGroup(CharacterFromID("Coastal_Captain02"), "None", "", "");
   ChangeCharacterAddressGroup(CharacterFromID("Coastal_Captain03"), "None", "", "");

   DeleteAttribute(Pchar, "quest.Rand_ContrabandInterruptionAtSeaEnded"); // PB: Just in case
}
I think that should ensure that they DO disappear after escaping.
Extract attached to your main game folder to try it.

As an added bonus, I replaced the call to "UpdateRMRelation" (possibly extensive effects to ALL nation relations) with one to "ChangeRMRelation" (simple -10 points for a single nation).
This could have been triggered during the soldier dialogs and could make for some unexpected and unwanted surprises even without sinking/capturing their ships. :facepalm

Once we can have confirmed that this aspect of the Improved Smuggling functionality now behaves itself properly,
we can see about adding a random element to the appearance of those Coastguard Ships as well.
 

Attachments

  • SmugglingEscapeFix.zip
    73.8 KB · Views: 128
started playing (free play) just to work on the smuggling.

So as far as I remember

Started at Barbados so did conceicao, barbados,conceicao, barbados.

At Conceicao first up ignored the need for a schedule (no soldier in tavern) and went for it. The encounter chance was reported as 0. in 300 so not suprisingly wasn't found.

Next barbados again ignored looking for soldier (none in tavern) and this time there was a chance of being found (35,91 in 300). As far as I knew I got clean away but in quest log (first speightstown port save) it says I was found and had to fight my way out (news to me! - compile has move patrol to land and ships to sea too) - no loss of points to English.

Conceicao again no soldier again just went ahead same 0. in 300 odds shown.

Finally Barbados stayed overnight and there was a soldier in the morning who gave me the safe period. Ignored it and went ahead (at the wrong time). Odds seemed quoted as 0. in 300 but I was caught on land regardless so fought and killed coastguard, points now went to -10 with England (as I think is planned). Outsailed the coastguard (forgot to pick up the schedule first!) but CTD on going to worldmap.


On repeating from my saved game (pre 2nd Conceicao) there ws no CTD on avoiding Barbados ships. Remembered the schedule which has a time overlap error in its timings (see last 2nd speightstown port save).

So probably a problem if you're escaping while the program is trying to load up coastguards - escaping appeared to stop it mid stride if I interpret the log and effects first time at Barbados right. Might be a problem with the chance generation (unless I was lucky in the time I happened to choose).

Some problem with how the schedule is made up with overlap times (in book). What does seem to work is both the remove ships on worldmap and the lesser penalty in relations for being caught.

Here are related logs and saves in case you want to look at any of it. Compile AFTER CRASH is the CTD event but only starts after the second Conceicao smuggle.

I'll try somemore tomorrow on a different set of islands perhaps.
 

Attachments

  • smuggling.7z
    657.9 KB · Views: 141
Next barbados again ignored looking for soldier (none in tavern) and this time there was a chance of being found (35,91 in 300). As far as I knew I got clean away but in quest log (first speightstown port save) it says I was found and had to fight my way out (news to me! - compile has move patrol to land and ships to sea too) - no loss of points to English.
So according to the questbook, you WERE caught, but never saw either any soldiers nor the coastguard ship(s)? :shock

Some problem with how the schedule is made up with overlap times (in book). What does seem to work is both the remove ships on worldmap and the lesser penalty in relations for being caught.
So at least the changes that I made this weekend helped then; that is something at least.
Your story about 0 chance and being caught anyway does sound quite bizarre.
Clearly some more work is still needed....
 
Quite a lot of errors in those log files.
And I'm not sure how this here makes ANY sense whatsoever. o_O
Code:
Quest name error FOUND in CommonQuestComplete

Must be related to this:
Code:
RUNTIME ERROR - file: quests\quests_check.c; line: 428
missed attribute: win_condition
RUNTIME ERROR - file: quests\quests_check.c; line: 428
no rAP data

Please open PROGRAM\QUESTS\quests_check.c and add the code between "EXTRA CHECK":
Code:
void OnQuestComplete(aref quest)
{
   if(!CheckAttribute(quest,"over") && CheckAttribute(quest,"win_condition"))
   {
     if(quest.win_condition == "_") return;
     quest.over = "yes";
     // PB: Error checking -->
     ref PChar = GetMainCharacter();
     DeleteAttribute(PChar, "questnotfound");         // Make sure this is GONE!
   
     // EXTRA CHECK -->
     if (!CheckAttribute(quest, "win_condition"))
     {
       TraceAndLog("QUEST ERROR: Check compile.log!!!");
       DumpAttributes(quest);
     }
     // EXTRA CHECK <--

     // Common Quests
     CommonQuestComplete(quest.win_condition);         // <-- Execute the actual quest case
That should give us more details when it happens again.

EDIT: Or use the attached file. :doff

And to be clear here: This is NOT a fix; it is just an attempt to get the information we need to DO fix it.
 

Attachments

  • quests_check.zip
    3.3 KB · Views: 129
Last edited:
So according to the questbook, you WERE caught, but never saw either any soldiers nor the coastguard ship(s)? :shock
Well I guess the ships could have been there, in fact they probably were -I just headed out to sea without looking back and hit rapid up to 10 until the map icon appeared - but the fact that it took a moment or so to arrive meant something was hostile out there and since it was Barbados and I'm English was probably coastguards (that's what compile says too I guess with two hostile HMS ships).

So maybe not really dysfunctional - it just means that if you happen to time your boat entry as the coastguard finds you the first you may know of it is hostile ships - not a problem that was always possible even in stock POTC, but you might escape the -10 relations penalty (not a big deal either). Actually there might be an onscreen warning you have been found (there's such an entry in compile)- with smugglers debug level 3 there's so much on screen display it's hard to know what is normal game code and what is trace. I'll try without debug at some point. If so the only thing about this aspect then is the wording in the questbook of "I had to fight my way out" - or something similar, which might not quite be the case.
Quite a lot of errors in those log files.
And I'm not sure how this here makes ANY sense whatsoever. o_O
Code:
Quest name error FOUND in CommonQuestComplete

Must be related to this:
Code:
RUNTIME ERROR - file: quests\quests_check.c; line: 428
missed attribute: win_condition
RUNTIME ERROR - file: quests\quests_check.c; line: 428
no rAP data
EDIT: Or use the attached file. :doff

Yes I saw the quest name error log. I have added the extra trace code and will run from the same save again later.
 
It could be that error log entry is the reason why the coastguard soldiers didn't show up despite the questbook entry about being caught.

If I recall, you should get that questbook entry when you get caught on the shore, which should immediately trigger the soldier encounter.
The coastguard ships, at least for now, should ALWAYS be there if you arrive at the "wrong" time.
Only exception is if you talk to the soldiers and convince them everything is OK.
 
Well I tried another smuggling run. Dropped anchor, went into town and made the deal, bribed a soldier, and then headed to my ship to wait for 20 hours. Saved just before going to the shore. Walked past the smugglers and a bell chimed. Went to the ship and was greeted by a Heave East Indiaman, a Heavy Pinnace of War, and an Advanced warship. All hostile. Was trapped in the cove by the wind and got hammered.
POTC4 2015-10-29 20-51-03-68.jpg

Started over from that save and wandered aimlessly for hours. Went to the beach at the specified time and completed the deal and sailed away.

Overall smuggling is too much like swabbing the deck.
 
Walked past the smugglers and a bell chimed.

The bell sound was probably the quest book entry you get after talking to the smugglers on the beach -- which should tell you whether you have be found by the coastguard -- or have managed to avoid them completely.

What would you think of the idea of as well as the quest book entry - the dialog with the smugglers on the beach ended with something like.

" Thanks for the goods, mate -- you had better set sail quick and get out of here -- our lookouts have just spotted some coastguard vessels coming into the bay."
:checklist

Or words to that effect when the coastguard vessels have been ( are going to be generated ) - so that it is more obvious to the player that they are going to have to fight their way out.

Rather than having to check the quest book after talking to the smugglers on the beach, before sailing away, to see whether it says you have been caught or not.

:read

PS
Just out of interest - how long was the "safe time" period that you had for the smuggling run ?

:drunk
 
Last edited:
I am much more concerned about the ships following me around and possibly not letting me ever get back to Port Royal again.
 
I thought we had established that the Coastguard ships now DO disappear after escaping to the worldmap.
 
I went back to Jamaica again and there were no ships waiting for me, so it seems the proper way to leave after smuggling is to go straight to the world map instead of direct sailing to the next island.
 
A DirectSail update should trigger the "go on worldmap behaviour" too.
Hook added that many, many years ago.

Do you have a compile.log file of your escape?
That should tell us if the correct quest case did ever get triggered.
 
Else we can just change it to exit location...
 
Else we can just change it to exit location...
But we shouldn't need to come up with a separate fix for the smuggling escape, because it should be already working.
If it doesn't, then there may be a larger problem. That's why I want to know for sure first if it does or doesn't do what it is supposed to.
 
Looks like the code to do this on a DirectSail reload as well IS still in place.

Here it is set to be triggered upon "MapEnter" in PROGRAM\smuggling.c:
Code:
void SetCoastalGuardPursuit()
{
    ref Pchar = GetMainCharacter();
    if(DEBUG_SMUGGLING>2) trace("SMUGGLING move coastguard to the sea");
    Group_SetTaskAttack("Coastal_Guards", PLAYER_GROUP, true);
    Group_LockTask("Coastal_Guards");
    Group_SetPursuitGroup("Coastal_Guards", PLAYER_GROUP);
    Group_SetAddress("Coastal_Guards", Islands[GetCharacterCurrentIsland(Pchar)].id, "", "");
    // PB: Ensure they're deleted after escaping -->
    Pchar.quest.Rand_ContrabandInterruptionAtSeaEnded.win_condition.l1 = "MapEnter";
    Pchar.quest.Rand_ContrabandInterruptionAtSeaEnded.win_condition = "Rand_ContrabandInterruptionAtSeaEnded";
    // PB: Ensure they're deleted after escaping <--
}

This is how "MapEnter" can be triggered according to PROGRAM\QUESTS\quests_check.c:
Code:
    case "MapEnter":
        // LDH added 21Feb09
        if (CheckAttribute(refCharacter,"directsail1.QuestCheckMapEnter"))    // set in Directsail upon islandswitch
        {
            DeleteAttribute(refCharacter,"directsail1.QuestCheckMapEnter");
            return true;
        }
        return IsEntity(&worldMap);    //TIH bugfix from stock //return IsEntity(worldMap);
    break;

And the attribute needed there for the DirectSail option is added here just before the reload to the next island in PROGRAM\CCCdirectsail.c:
Code:
void DirectsailRun()  // Jan 07, taken out of DirectsailCheck() to create break
{
    DelEventHandler("DirectsailRun", "DirectsailRun");

    ref pchar = GetMainCharacter();

    // check if islandchange takes place
    bool islandswitch;
    if(ACCURATE_NAVIGATION){islandswitch = DirectIslandCoordCheck();} // use Screwface's mapcoord method
    else {islandswitch = DirectIslandCellCheck();} // use islandcell method

    if(islandswitch)
    {
        // islandchange
        // some eyecandy
        CreateEntity(&SeaFader, "fader");
        SendMessage(&SeaFader, "ls", FADER_PICTURE0, FindReloadPicture("LandHo.tga")); // KK
        SendMessage(&SeaFader, "lfl", FADER_IN, 0.5, true);
        PlaySound("#land_ho"); // KK
        // LDH Only set the encounter flag if we're due for an encounter - 11Feb09
        if(stf(pchar.directsail.count) >= ENCOUNTERBREAK)
            pchar.directsail.encounter = 1; // for new ships at new island
        // LDH 21Feb09 - Set MapEnter condition for quests, removed when MapEnter condition is checked in ProcessCondition()
        pchar.directsail1.QuestCheckMapEnter = true;

        Sea_ReloadStartDirect();    // reloads Sea with new island at horizon
    }

So @Hylie Pistof, it is meant to work also for a DirectSail island reload. If you still have the compile.log file of that situation, please post it.
If not, please try it again because I'd really like to know if that got broken in some way! :shock
 
Back
Top