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

Solved Quests Not Executing

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
As per these observations, it seems we've got a bit of an issue with quest cases not executing:
I was playing today though and was plagued quite a bit with non-executing quest code though. REALLY annoying. :boom:
I've noticed this slightly more than usual, as well. On two different occasions when starting the Sea Hawk storyline, the French blockade didn't spawn when I first left Speightstown. :facepalm
This is not a new problem though:
It should be said that I've observed non-executing quest cases already many years ago, back when I was reworking the First Contact sidequest a bit.
That's the one that proved to me why saving often and reloading from an earlier save is unfortunately crucial with this game.
Because it was not a problem with the actual quest code; that was all fine. It just didn't get executed. :modding

It seems that whenever this occurs, the following is logged in error.log:
Code:
RUNTIME ERROR - file: quests\quests.c; line: 1266
Invalid function call
RUNTIME ERROR - file: quests\quests.c; line: 1266
function 'CompleteQuestName' stack error
This refers to PROGRAM\QUESTS\quests.c:
Code:
void CompleteQuestName(string sQuestName)
{
    if( CheckAttribute(&objQuestScene,"list."+sQuestName+".chrIdx") )
    {
        Event("qprocTaskEnd","a",GetCharacter(sti(objQuestScene.list.(sQuestName).chrIdx)));
    }
    else
    {
        CommonQuestComplete(sQuestName); // KK
        QuestComplete(sQuestName); // <-- THIS LINE
        BothQuestComplete(sQuestName);
    }
}
However, when you then reload your savegame, it DOES work. So it is a very inconsistent problem.

Please post here every time this happens. Hopefully we can sort-of figure out where this is coming from.
Perhaps there IS some consistency to it? Just something we haven't found yet?
 
Examples I ran into so far playing the Jean Lafitte storyline:

------------------------------------------------------------------------------------------------

case "revenge_for_bandits" from both_reaction.c not being executed. Should be triggered by Zaid Murro's dialog file:
Code:
            pchar.quest.revenge_for_bandits.win_condition.l1 = "location";
            pchar.quest.revenge_for_bandits.win_condition.l1.location = "Muelle_town_exit";
            pchar.quest.revenge_for_bandits.win_condition = "revenge_for_bandits"; //NK fix
Then occur when you enter San Juan town exit.

------------------------------------------------------------------------------------------------

case "Story_gotoQC" from both_reaction.c not being executed. Should be triggered by Estrella de Alancar's dialog file:
Code:
        case "eda_node19":
            dialog.text = DLG_TEXT[78] + GetMyName(Pchar) + DLG_TEXT[79];
            GiveItem2Character(Pchar,"estrella_token");
            link.l1 = DLG_TEXT[80];
            link.l1.go = "exit_gotoQC";   
            AddQuestRecord("estrella", 1);
        break;
       
        case "exit_gotoQC":
            AddDialogExitQuest("Story_gotoQC");
            NextDiag.CurrentNode = NextDiag.TempNode;
            DialogExit();
        break;
This is all that is supposed to be triggered, but it never happened:
Code:
            ChangeCharacterAddressGroup(characterFromID("Armand Delacroix"), "QC_tavern", "Sit", "Sit8");
            pchar.quest.estrella_qc = "here";

------------------------------------------------------------------------------------------------

case "Missing_start_search" from both_reaction.c not being executed. Should be triggered by Angelique Moulin's dialog file:
Code:
        case "begin_4":
 
            NextDiag.CurrentNode = NextDiag.TempNode;
            DialogExit();
 
            AddDialogExitQuest("Missing_start_search");
        break;
This is what that needs to do:
Code:
            LAi_SetCitizenType(CharacterFromID("Angelique Moulin"));
            PChar.quest.Missingman = "search";
            DeleteEnterLocationQuest("Port_au_Prince_town", "Missing_start_check");
            bSuppressResurrection = true;
            SetQuestHeader("Moulin");
            AddQuestRecord("Moulin", 1);
            ChangeCharacterAddressGroup(CharacterFromID("Robert Durand"), "Buccaneers_Camp", "goto", "goto16");
            ChangeCharacterAddressGroup(CharacterFromID("Buccaneer_01"), "Buccaneers_Camp", "goto", "goto42");
            ChangeCharacterAddressGroup(CharacterFromID("Buccaneer_02"), "Buccaneers_Camp", "goto", "goto12");
            ChangeCharacterAddressGroup(CharacterFromID("Buccaneer_03"), "Buccaneers_Camp", "goto", "goto15");
            Characters[GetCharacterIndex("Robert Durand")].dialog.currentnode = "First time";

------------------------------------------------------------------------------------------------

In all those instances, loading an earlier save and trying again would make it work.
 
Also this one: http://www.piratesahoy.net/threads/new-game-bug.20667/#post-452922
Possibly triggered by dying. It is slightly different in its error though:
Code:
RUNTIME ERROR - file: quests\quests_check.c; line: 415
Invalid function call
RUNTIME ERROR - file: quests\quests_check.c; line: 415
function 'OnQuestComplete' stack error
This does return us to similar code though:
Code:
void OnQuestComplete(aref quest)
{
    if(!CheckAttribute(quest,"over") && CheckAttribute(quest,"win_condition"))
    {
        quest.over = "yes";
        CommonQuestComplete(quest.win_condition); // KK
        QuestComplete(quest.win_condition); // <-- THIS LINE
        BothQuestComplete(quest.win_condition);
    }
}
One part of consistency that I detect is that the problem always seem to occur on the QuestComplete (eg. quests_reaction.c) line, but NOT on the CommonQuestComplete which seems fine.

Two thoughts:
1. quests_reaction.c and both_reaction.c are both in the Storyline folder and NOT in the QUESTS folder. Could that make a difference?
2. What would happen if we swapped QuestComplete and BothQuestComplete? Will the problem move to BothQuestComplete then or remain in QuestComplete?
 
TESTING HELP NEEDED!

I put some error-checking code in the quest system now that will hopefully give us more information whenever this problem rears its ugly head again.
Extract attached to your main game folder; no new game required.

This will put an on-screen and compile.log message whenever ANY quest case is executed.
Hopefully that will allow us to track what does and does not work.
Additional tracking code is being logged in compile.log .

Edit: Additional on-screen ERROR log messages added for:
1. Quest case not found in any file
2. Missing character ID
3. Random ship encounter did not return model

Whenever these occur, they will be logged in COMPILE.log (NOT error.log) starting with "error".
So please check your compile.log after EVERY time you played for those lines.
And also post it whenever you noticed a quest case not executing. If possible, please specify which one.

For 1 and 2 I need to know WHICH storyline and WHICH character/quest case are missing.
For 3 we only need to see how frequently this happens for the Ship Encounter Changes.

Edit 2: See here for the test files:
http://www.piratesahoy.net/threads/build-14-beta-3-progress.20686/
 
Oh... if you ARE going to test this, it helps to actually play quests. Main quests, side quests, anything. But free play probably won't show much of a problem from this. :facepalm
 
You don't have to start a few. Just stick with one and keep an eye on quest stuff not working.
If you run into anything, post the compile.log here. :doff
 
I started the standard storyline and while it seems to work fine these messages keep popping up on screen. I changed my characters outfit and still get this message.
quest-1.jpg
 

Attachments

  • compile.log
    98.4 KB · Views: 132
Those messages will show up for EVERY quest case, including those that DO work.

I saw those ones as well though and they seem to be for the Woodes Rogers storyline only,
so I made some code changes to make them run only IN that storyline, which should clear up the screen in the others.
Will upload those changes soon.
 
Hmm, "pistol20_ammo_check" and "pchar_outfit_check" are both placed in questreaction for WoodesRogers yes.
And started from that quest too.
How can they be activated from another storyline? Have you maybe visited Rogers and returned to standard or what? :confused:
 
Hmm, "pistol20_ammo_check" and "pchar_outfit_check" are both placed in questreaction for WoodesRogers yes.
And started from that quest too.
How can they be activated from another storyline? Have you maybe visited Rogers and returned to standard or what? :confused:
They're not being activated, but they ARE being called. I've made some changes so the calls ONLY occur in your storyline.
Shouldn't make a difference to how the game runs, but it'll make sure those log messages won't needlessly appear. :shrug
 
I'll keep an eye out for any of these errors while playing. If nothing else, having a message confirming that a quest event hasn't worked will be useful for gameplay, so I'll know when to go back to a previous save.
 
Does this qualify as a quest item?

CompleteQuestName called for pistol_ranking_list
Quest name pistol_ranking_list not found in CommonQuestComplete
Quest name pistol_ranking_list not found in BothQuestComplete
Quest name pistol_ranking_list not found in QuestComplete
ERROR - Quest name pistol_ranking_list NOT found in ANY function

It is in this compile about 2/3rds of the way down.
 

Attachments

  • compile.log
    109.5 KB · Views: 137
I'm afraid "pistol_ranking_list" is from me too. :wp
Ok they are called from general functions in other files such as fire pistol pick up an item etc.
I will of course help you with limiting this to WoodesRogers but have to leave home for a few days.
I'll have internet but can't mod.
Tell me if you want to me clear out all these references to "my" questreaction.

One more thing I found a minor error in my storyteller thing.
Should I upload now or wait for an official patch?
 
I'm afraid "pistol_ranking_list" is from me too. :wp
Technically there is no problem with these function calls. It's definitely NOT the source of our REAL troubles; we had those long before your storyline.
We can still address them, but just to prevent cluttering up the screen with those messages.

Ok they are called from general functions in other files such as fire pistol pick up an item etc.
I will of course help you with limiting this to WoodesRogers but have to leave home for a few days.
I'll have internet but can't mod.
I can handle those; you don't need to worry about it.
One thing I was wondering about though: You have a LOT of extensive code in various files. I thought perhaps you could put those into a function of your own and perhaps a file of your own called "JRH_functions.c"?
That shouldn't solve any problems, but cleans up the code in the main game files quite a bit. That'd be easier to sift through for me when WinMerging stuff.
When I was doing the Treasure Quest work, I had to temporarily remove your code because otherwise I had to do too much scrolling. :facepalm

One more thing I found a minor error in my storyteller thing.
Should I upload now or wait for an official patch?
You can post now or later; doesn't matter either way. :doff
 
I thought perhaps you could put those into a function of your own and perhaps a file of your own called "JRH_functions.c"?
I'll see what I can do in the future.

That'd be easier to sift through for me when WinMerging stuff.
You mean in itemlogic for example?

...otherwise I had to do too much scrolling.
I know what you mean. I put in an unique searchword which takes me right where I want.
That's why you see my own name left here and there.

Only thing I don't understand is why these messages show up on the screen.
To me it looks like text you find in compile log.

I have tested the WoodesRogers storyteller and am sorry to say that the function of returning to cabin will be skipped soon.
It's too complex - I can't control everything - meaning can't reset all.
 
Back
Top