• 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 Storyline unloads and fails to reload

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
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 + "!!!");
       }
 

Attachments

  • compile.log
    7.1 KB · Views: 179
  • error.log
    308 bytes · Views: 230
  • system.log
    2.2 KB · Views: 208
@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?
 
What is on storyline\Ardent\quests\quests_reaction.c; line: 3213 ?
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.
And what is in Storyline\Ardent\SL_utils.c?
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;
   }
}

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?
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.
 

Attachments

  • quests_reaction.c
    472.4 KB · Views: 244
  • SL_utils.c
    1.6 KB · Views: 187
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.
 
"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.
 
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.
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 .
 
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");
       }
   }
 
I'm not sure. At the moment I'm trying to get my Hornblower sidequest finished. Last time I played the "Ardent" storyline, I've a vague memory that it did happen again. The problem is that it's random, infrequent, and not repeatable - loading the last savegame from before the error and then doing exactly the same things does not lead to a repeat of the error.
 
Yes, I did add that. It should be in the version of "post_August31_fixes" currently on the FTP site.
 
Back
Top