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

Mod Release Age of Pirates: Caribbean Tales - Historical Immersion Supermod

Took a quick look at the code.
What is the meaning of quester1.c ?
As far as I can see it's never included so no wonder it isn't run. Also it's missing a main function.
Take a closer look at how the storyline file works and make it like that (so with all cases etc.).
If you want it to be a seperate file you need to add a function just like the storyline at the start of the file (you can copy everything untill the switch) and make sure you take the same architecture as the switch.
Name the function differently.
so it should look something like this:
Code:
void YourQuestComplete(string sQuestName, string qname)
{
    ref chr;

    //trace("--- QUEST " + sQuestName + " CHECKED ---");
    int iChar = -1;
    int iShipChar = -1;
    string sVideoFile = "";

    switch(sQuestName)
    {
       HERE IS YOUR CONTENT WITH CASES
    }
}
In quest.c add a include for you file like this
Code:
#include "quests\quester1.c"
and in that file search for "StoryLineQuestComplete".
Add your function after that so like this:
Code:
StoryLineQuestComplete(sQuestName, qname);
YourQuestComplete(sQuestName, qname);
Then it should run it to.

Please tag me if you have more questions cause I normally dont look here.
I've never created a quest before, especially in C++. So your saying that the quest needs a proper start point like the beginning of the story_line.c? I'm a super noob at this.....:bounce

P.S. New Holland Town Theme is almost picture perfect.
 
Ok if you are new to this then I can understand.
I don't know exactly how they do it in this game but there are many ways,
Are the files for quests (sidequest etc) or is there just the storyline file? (I dont have the game).
 
The main quest is separate.
the sidequests and quests from the governors are grouped together in a category.
here's the files path:
Under Program/Quests:
characters_task.c
Quest_Messages.h
quester1.c (dutchman quest)
quests.c
quests_abordage.c
quests_check.c
quests_movie.c
quests_reaction.c
quests_scenes.c
story_line.c

attached is the full "quests" folder with original code for quester1.c!
 

Attachments

  • quests.7z
    27 KB · Views: 178
I sugest adding your stuff (the quest1.c) to quest_raction.c and add comments so you know it's from your quest.
 
I reworked the quest and the quests.c file to your specs in post #120. I get this error:

"COMPILE ERROR - file: quests\quests_check.c; line: 395
Duplicate variable name: condition"

This creates a Runtime error loop not allowing the game to start.

EDIT: there was a missing comma, but a new error comes up
"COMPILE ERROR - file: quests\quests_check.c; line: 397
Duplicate variable name: bTmp"

No missing comma this time! :rumgone
 
Last edited:
A variable can only be defined once. So say you have
Code:
bool bTmp = false;
somewhere then if you wanna change it you need to use
Code:
bTmp = true;
and don't add the bool anymore. That's the problem you have somewhere in your script ;).
 
I'm getting cascade bugs. I'm debugging now every line of code in the game.

So far at 200 lines changed.
 
Last edited:
All lines have been changed/debugged of all the repeating definitions of variables (some "undefined" variables had to be removed to get to this step). I ran the game and it got to the loading screen before the Runtime Error. We are close, but we have a major problem with the Extern.h file (Path = Net/Extern.h) and a minor error in the NetServer.c (Path = Net/NetServer.c):

ERROR DOCUMENT DATA:
Code:
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'Net_SaveFile' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'Net_LoadFile' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'Net_GetTickCount' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'Net_Sort2i' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetIni_GetLong' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetIni_GetString' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_AddClient' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_DelClient' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_SendMessage' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_SendMessageAllExcept' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_SendMessageDirect' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_SendMasterServerMessage' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_GarantedDeliveryCallback' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetServer_ClearPacketsQueue' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetClient_SendMessage' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetClient_GarantedDeliveryCallback' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetClient_SendMessageDirect' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetClient_SendMessageDirectToIP' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetClient_SendBroadcastMessage' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetClient_SendMasterServerMessage' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NetClient_ClearPacketsQueue' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMCreate' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMDelete' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMNotEmpty' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMGetByte' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMGetWord' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMGetDword' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMGet24' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMGetFloat' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMGetString' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMAddByte' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMAddWord' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMAddDword' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMAdd24' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMAddFloat' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMAddString' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NMAddData' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'inet_ntoa' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'inet_ntoax' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'ntohs' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFFindFiles' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFExist' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFRCreateFile' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFRDeleteFile' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFRReceiveData' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFRIsEqualFile' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFRSetSendHandle' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFSCreateFile' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFSDeleteFile' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFSReceiverReady' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFSDataACK' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFGetTexture' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFDelTexture' not declared
COMPILE ERROR - file: Net\Extern.h; line: 87
native function 'NFDelGroupTextures' not declared
COMPILE ERROR - file: Net\NetServer.c; line: 35
Invalid array (NSSortedPlayers) size

Attached is the files with errors.
 

Attachments

  • badfiles.7z
    3.5 KB · Views: 167
Last edited:
And this is just while trying to do some 'simple' quest work? I do believe something went very wrong.
Perhaps there is a missed bracket somewhere that is throwing all the code out of whack?
 
I dont know this good well enough to be able to comment on this but my guess is you removed some reference to a file or something like that. Or you removed a object so thats what causes these errors.
 
How do you declare a native function in code and how do you fix invalid array with coding? In declaring the native function all I have to do is declare all of them on line 87 of Extern.h then just have to find out how to fix an invalid array in line 35 and the code should work (in theory). Any ideas?
 
This did work before so there must be another problem ...
The native function seem to be declared just right so something else has to be wrong. Sometimes the error codes don't work.
Normally if you add stuff you should only focus on the stuff you added to find the errors cause the rest did work before.
 
I doubt you can. The modpack content would have to be translated first for that.
There is nobody around to do that though and something like that is a big job indeed.
 
This did work before so there must be another problem ...
The native function seem to be declared just right so something else has to be wrong. Sometimes the error codes don't work.
Normally if you add stuff you should only focus on the stuff you added to find the errors cause the rest did work before.
I don't know where I should go from there.o_O The original is still available in the old version. The only thing I added is what you asked me to do in a previous post. Beforehand there were minor errors including an eventual process event stack error in the system.txt file, however no critical errors were there until I added the new quest using your directions. I think if we are to fix this from where we stand we should look only at the extern.h file..... at line 87. NetServer.c I believe I never touched while following the resulting error codes from adding the quest properly (its still dated 2006 under "date modified").

Here is Line 87 of Extern.h:
Code:
#libriary "NET_SCRIPT_LIBRIARY";

Here is line 35 of NetServer.c:
Code:
int        NSSortedPlayers[MAX_TOPPLAYERS];

In Extern.h isn't the "libriary" supposed to be spelled "library" (same for the all caps version)?

In Net Server.c can the "invalid array" error also mean "duplicate variable"? In this case because it is defined with "int" doesn't that mean in one single line in each affected code file it should only be defined once?

Source: Idea from HTML/CSS and a similar code from COAS/POTC

EDIT: I defined the "first set" of undefined functions at the end of the code. The game made new ones so I'm going to make more.:pirates

EDIT 2: I have determined that the file extern.h or at least the "h" extension, is a definition file for defining all the values like an external CSS template defines a webpage. I've also determined that each definition is missing a void to make the definition a non argument in the "C" language its written in. I'm running the game now to see if that void at the end in parenthesis did the trick or if I'm going to have to integrate it into the main parenthesis for the function definitions of "what to do if this variable is used". The previous test with the void added showed that there was only one critical error and that was with placement in the definitions. This is much better than the multiple definitions needing "redefining" on Line 87.:woot

EDIT 3: Looks like I have to integrate it at the end of the "what to do" parenthesis using a comma.:ninja
EDIT4: TOO MUCH :rumgone ....I'm trying now to use the "void" at the end without any parenthesis because the error code says duplicate variable ")"

EDIT5: Wow your touchy Mr. Language "C" :shock! Duplicate Variable Name: " " at line 5 of the extern.h file!?!? Now trying the position I originally had it without parenthesis, but spaces in between the definition name and the void. Oh and a bit of good news :D invalid array error is gone!

EDIT6: What a Wild Goose Chase!:shock The errors looped me back around to the original error.... this time with even less saved information about what that variable should do when its defined in the other code........:modding.

:ko I don't get it! Is this kind of thing what you are talking about Levis when the error code doesn't work?

Besides using the original code via reinstalling and utilizing the code that way, I see no way of resolving this problem from the way I see it on my end......
 
Last edited:
Epiphany at last Levis:D!

I think I know whats wrong now. I should of caught this sooner:wp.

For story_line.c in quests.c it says "void story_line quest complete", but for quester1.c it says "DutchmanQuest complete" mirrored in quests.c. I think The files and the code needs to be identical in name.

For Story_Line:
story_line.c
void storylinequestcomplete (in story_line.c)
#include story_line.c (in quests.h)
storylinequestcomplete (in quests.h)

For Dutchman (old):
quester1.c
void dutchmanquestcomplete (in quester1.c)
#include quester1.c (in quests.h)
dutchmanquestcomplete (in quests.h)

For Dutchman (Proposed):
dutchman.c
void dutchmanquestcomplete (in dutchman.c)
#include dutchman.c (in quests.h)
dutchmanquestcomplete (in quests.h)

I don't think there was anything wrong with the other files at all. Thank god I have the backup on the original mod. Ill try it and report back.
 
SUCCESS! THE GAME WORKS!:shipI also found out that the quests were conflicting with each other so I used a quest check delay to start the quest when the player is rank 2. I'm also working on the quest intro and outro videos.
 
Videos complete..... Ready to test the quest in full. The quest check delays seem to work better than the "win conditions".
With the quests behaving themselves I can now focus only on the quest file, leaving everything else alone. I also updated the mod DB news for the mod (its about time) telling them the delay of the 4.0 update is due to the new quest, but for right now its going smoothly.
 
Back
Top