1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Unconfirmed Bug Storyline unloads and fails to reload

Discussion in 'Build Mod Bug Tracker' started by Grey Roger, Sep 12, 2017.

  1. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,020
    Playing "Ardent", I'm at the point where he goes to the temple on Hispaniola. When I went into the temple, there was an error on the screen, "ERROR - Unable to load storyline\Ardent\quests\quests_reaction.c!!!". It was also copied to "compile.log". "error.log" complained about function "StoreDialog", which is defined in "PROGRAM\Storyline\Ardent\SL_utils.c".

    This is not consistent. I reloaded a savegame from where I was in the area of the temple, about to fight some Indians, and when I then went into the temple, the error did not happen again. Nor is it confined to this area - I occasionally had the same thing happen in various places while playing the game based on the 7th January installer. Sometimes it happened when I went to a new location which had nothing to do with the storyline.

    The error message comes from "PROGRAM\QUESTS\quests.c", function "LoadStorylineFile":
    Code:
           if (!SegmentIsLoaded(segName))
           {
               bSegLoaded = LoadSegment(segName);
               trace(segName + " not loaded, loading now!");
           }
           if (!SegmentIsLoaded(segName))
           {
               TraceAndLog("ERROR - Unable to load " + segName + "!!!");
           }
     

    Attached Files:

  2. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,125
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    @Grey Roger: It must be because of this error message:
    Code:
    COMPILE ERROR - file: storyline\Ardent\quests\quests_reaction.c; line: 3213
    function StoreDialog(args:0) doesnt accept 1 arguments
    RUNTIME ERROR - file: quests\quests_check.c; line: 438
    Invalid function call
    RUNTIME ERROR - file: quests\quests_check.c; line: 438
    function 'OnQuestComplete' stack error
    
    What is on storyline\Ardent\quests\quests_reaction.c; line: 3213 ?
    And what is in Storyline\Ardent\SL_utils.c?

    This error used to occur randomly before as well without error, which randomly broke quests left, right and center.
    It took me forever to figure it out, couldn't prevent the quest code from being unloaded, but at the very least changed the code so that if it detected it was unloaded, it would try again.
    Should be a VERY rare occurrence now for it to fail again! :shock

    Does it happen only at that specific point or also when you Start New Game/Load Save?
     
  3. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,020
    Code:
    StoreDialog(ch);
    It's part of case "abduction_sanjuan_witness", and I haven't even got to that part of the story in this playthrough. It's where you return to San Juan and one of the citizens tells you that Lucia has been abducted. Rather than try to insert the relevant dialog into "isla muelle citizen_dialog.c/h", I use function "StoreDialog" to note his existing dialog filename and node, then switch him to use my own dialog file, and then use function "RestoreDialog" (also in "SL_utils.c") to put him back to normal. It works - I've completed the story, including that scene, before, and the same pair of functions are used to hijack other characters the same way.
    Among other functions:
    Code:
    bool StoreDialog(ref ch)
    {
       if (CheckAttribute(ch, "quest.original_dialog_filename"))
       {
           return false;
       }
       else
       {
           ch.quest.original_dialog_filename = ch.Dialog.Filename;
           ch.quest.original_dialog_CurrentNode = ch.dialog.CurrentNode;
           return true;
       }
    }
    Neither of those. It happens randomly after I've been playing for a while, not right after a new game, load or save. It does not happen at the same point. In particular, after it's happened, I can load a previous savegame, do exactly the same things as I did the first time, and not get the error. It is indeed a rare occurrence, but still does happen occasionally.
     

    Attached Files:

  4. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,125
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Error.log claims that the game expects StoreDialog to take ZERO input arguments. That doesn't match with your own function definition though.

    Are there any other examples of 'StoreDialog' in the PROGRAM folder? Is that a function you wrote yourself?

    Two things I can think of:
    1. "SL_utils.c" is unloaded, so the game doesn't recognize your custom function
    2. "StoreDialog" is already defined somewhere else, maybe even inside the ENGINE/MODULES files where we cannot access it

    Then some things to test:
    1. Start a storyline that doesn't have this function, then try to use it anyway through console.
    Try both StoreDialog(CharacterFromID("YOUR CHARACTER")) with 1 argument and StoreDialog() with zero arguments.
    2. Rename the funcion to something else, such as "StoreDialog_GR" so that you're certain there can be no interference with another copy of the same function anywhere else.
     
  5. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,020
    "StoreDialog" is, as far as I can tell from a Windows search, only defined in "SL_utils.c", and only called in "quests_reaction.c".

    Evidently "quests_reaction.c" was unloaded at some point, then the game tried to reload it. For some reason it failed to reload "SL_utils.c" at the same time. Of course, if I then load the savegame, it reloads the whole storyline, including both "quests_reaction.c" and "SL_utils.c", and that's why it then continues after loading the savegame.

    I'm seriously inclined to put my functions back where I had them originally, which was at the end of "quests_reaction.c", outside the definition of function "QuestComplete". Unloading and reloading "SL_utils.c" is not reliable.
     
  6. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,125
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    That does sound plausible.

    But maybe an alternate solution is possible by editing quests.c .
    Should be possible to have that check if "SL_utils.c" is properly loaded and, if it's not, load it BEFORE trying to reload quests_reaction.c .
     
  7. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,020
    The relevant piece of code is probably this, from function "CompleteQuestName":
    Code:
           // Main Quests
           LoadStorylineFile("quests\", "quests_reaction.c");       // PB: To Prevent Errors
           QuestComplete(sQuestName);                               // <-- Execute the actual quest case
           if(!CheckAttribute(PChar, "questnotfound"))
           {
               trace("Quest name " + sQuestName + " FOUND in QuestComplete");
               return;
           }
           DeleteAttribute(PChar, "questnotfound");
    
           // Both Quests
           LoadStorylineFile("quests\", "both_reaction.c");       // PB: To Prevent Errors
           BothQuestComplete(sQuestName);                           // <-- Execute the actual quest case
           if(!CheckAttribute(PChar, "questnotfound"))
           {
               trace("Quest name " + sQuestName + " FOUND in BothQuestComplete");
               return;
           }
           DeleteAttribute(PChar, "questnotfound");
    I'm guessing that, before both those 'LoadStorylineFile' lines, I'd need to add this:
    Code:
       if (FindFile("PROGRAM\" + GetStorylinePath(FindCurrentStoryline()), "*.c", "SL_utils.c") != "")
       {
           if (!SegmentIsLoaded(GetStorylinePath(FindCurrentStoryline()) + "SL_utils.c"))
           {
               LoadSegment(GetStorylinePath(FindCurrentStoryline()) + "SL_utils.c");
           }
       }
     
  8. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,125
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    That's indeed pretty much what I had in mind. :onya
     

Share This Page