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

Various tech support stuff

Makes sense, but the strange part is I don't have any English folders anywhere, which is EXTREMELY bizarre...
Where are your .h files, if not in "PROGRAM\DIALOGS\English"?
In the US version the C files and H files are both in PROGRAM\DIALOGS.

To possibly help clarify further how the dialogs work, a character might say this: "Hello, Nathaniel! Good to see you!"
The C file might have this: DLG_TEXT[50] + PChar.name + DLG_TEXT[51]
Which in the H file might be this:
Code:
"Hello, ",
"! Good to see you!",
That's why you can see single punctuation marks at various lines.
 
Last edited:
In the US version the C files and H files are both in PROGRAM\DIALOGS.

To possibly help clarify further how the dialogs work, a character might say this: "Hello, Nathaniel! Good to see you!"
The C file might have this: DLG_TEXT[50] + PChar.name + DLG_TEXT[51]
Which in the H file might be this:
Code:
"Hello, ",
"! Good to see you!",
That's why you can see single punctuation marks at various lines.
Right, due to the translation thingy, I gathered as much, right then, makes sense, I'll have to keep track of dialog then. Time to engage big brain mode!
 
Right, now I've run into an issue, now whenever I start a new game from firing it up, it fades to a black screen and no sound, when I load to an existing save and then start a new save, Malcolm is nowhere to be found, no way out of my ship, I have my existing equipment and data, I'm confused...

Right, now I've run into an issue, now whenever I start a new game from firing it up, it fades to a black screen and no sound, when I load to an existing save and then start a new save, Malcolm is nowhere to be found, no way out of my ship, I have my existing equipment and data, I'm confused...
It would appear that everything has turned into errors...

It would appear that everything has turned into errors...
I've narrowed down the issue to be something to do with poor Rexy, here's his line of code in Officers.c

Code:
makeref(ch,Characters[n]);            //Rex Hathaway
    ch.name     = "Rex";
    ch.lastname     = "Hathaway";
    ch.id        = "Rex Hathaway";
    ch.model    = "soldier_eng5";
    ch.sex = "man";
    ch.loyality = 15;
    ch.alignment = "good";
    ch.sound_type = "soldier";
    GiveItem2Character(ch, "BLADE_SABER");
    ch.equip.blade = "BLADE_SABER";
    ch.location    = "Redmond_tavern";
    ch.location.group = "goto";
    ch.location.locator = "goto 16";
    ch.Dialog.Filename = "Rex Hathaway_dialog.c";
    ch.greeting = "Gr_Rex Hathaway";
    ch.rank     = 1;
    ch.reputation = "45";
    TakeNItems(ch,"potion1", Rand(4)+1);
    ch.experience = CalculateExperienceFromRank(1)+ (CalculateExperienceFromRank(1)/10 + rand(500));
    ch.skill.Leadership = "1";
    ch.skill.Fencing = "1";
    ch.skill.Sailing = "0";
    ch.skill.Accuracy = "1";
    ch.skill.Cannons = "1";
    ch.skill.Grappling = "1";
    ch.skill.Repair = "1";
    ch.skill.Defence = "0";
    ch.skill.Commerce = "0";
    ch.skill.Sneak = "0";
    ch.money = "0";
    ch.quest.help = "0";
    ch.quest.dialog = "0";
    LAi_SetCitizenType(ch);
    LAi_SetStayType(CharacterFromID("Rex Hathaway");
    n = n + 1;
The weird part is that I can't see anything obviously wrong, but then again, that's me being an absolute noob at C/C++...
 
I see some potential issues. Try this instead:
Code:
    makeref(ch,Characters[n]);            //Rex Hathaway
    ch.name     = "Rex";
    ch.lastname     = "Hathaway";
    ch.id        = "Rex Hathaway";
    ch.model    = "soldier_eng5";
    ch.sex = "man";
    //ch.loyality = 15;
    //ch.alignment = "good";                //Disable these two at least temporarily.
    ch.sound_type = "soldier";
    GiveItem2Character(ch, "BLADE_SABER");
    ch.equip.blade = "BLADE_SABER";
    ch.location    = "Redmond_tavern";
    ch.location.group = "goto";
    ch.location.locator = "goto16";            //This was "goto 16" with a space.
    ch.Dialog.Filename = "Rex Hathaway_dialog.c";
    //ch.greeting = "Gr_Rex Hathaway";        //Have you assigned a greeting sound file? If not then disable this for now.
    ch.rank     = 1;
    ch.reputation = "45";
    TakeNItems(ch,"potion1", Rand(4)+1);
    ch.experience = CalculateExperienceFromRank(1)+ (CalculateExperienceFromRank(1)/10 + rand(500));
    ch.skill.Leadership = "1";
    ch.skill.Fencing = "1";
    ch.skill.Sailing = "0";
    ch.skill.Accuracy = "1";
    ch.skill.Cannons = "1";
    ch.skill.Grappling = "1";
    ch.skill.Repair = "1";
    ch.skill.Defence = "0";
    ch.skill.Commerce = "0";
    ch.skill.Sneak = "0";
    ch.money = "0";
    //ch.quest.help = "0";
    //ch.quest.dialog = "0";                //Remove or at least disable these two.
    //LAi_SetCitizenType(ch);                //Remove one of these depending on which type you want him to be.
    LAi_SetStayType(ch);                    //Since this is his code block it should be "ch" instead of "CharacterFromID".
    n = n + 1;
 
The lines:
Code:
    ch.loyality = 15;
    ch.alignment = "good";
... are for a game feature which I'm not sure exists in the stock game. The idea is supposed to be that some quests trigger loyalty checks by your officers depending on whether you made a good or evil choice. Characters with these two attributes will gain or lose loyalty depending on whether your action conflicts with their alignment and if their loyalty drops to 0, they may desert. The Build Mod certainly implements this and I remember having to modify the code to prevent the loyalty check from doing anything if the "loyality" and "alignment" attributes are not set. So I've no idea what removing those attributes will do in the stock game. Loyalty 15 is very high anyway, you'd need to do a lot of "bad" things to make this character desert - I'm not sure if there are even enough checks to allow loyalty to drop from 15 to 0 even if you make the "bad" choice at every possible occasion! So I'd be inclined to leave those two lines active.

For the 'ch.greeting' line, look at some other characters, see what they have, and copy it from someone suitable. In any case, if there is no "Gr_Rex Hathaway", the worst that I'd expect to happen is what will happen anyway if you don't have that line, which is that you don't hear him say anything when you talk to him. It shouldn't cause a game crash.

The line which is causing trouble is almost certainly:
Code:
LAi_SetStayType(CharacterFromID("Rex Hathaway");
Character ID "Rex Hathaway" doesn't exist yet - it is this block in the character file which is going to define it. You can use that in quest code later, but as @Baste says, in this file it should be 'ch', not 'CharacterFromID("Rex Hathaway")'.

Remove this line:
Code:
LAi_SetCitizenType(ch);
It's about to be replaced by the 'LAi_SetStayType' on the next line so it's redundant. You don't want him in "citizen" mode anyway, as that makes him wander around - you want him to stand still.
 
The lines:
Code:
    ch.loyality = 15;
    ch.alignment = "good";
... are for a game feature which I'm not sure exists in the stock game. The idea is supposed to be that some quests trigger loyalty checks by your officers depending on whether you made a good or evil choice. Characters with these two attributes will gain or lose loyalty depending on whether your action conflicts with their alignment and if their loyalty drops to 0, they may desert. The Build Mod certainly implements this and I remember having to modify the code to prevent the loyalty check from doing anything if the "loyality" and "alignment" attributes are not set. So I've no idea what removing those attributes will do in the stock game. Loyalty 15 is very high anyway, you'd need to do a lot of "bad" things to make this character desert - I'm not sure if there are even enough checks to allow loyalty to drop from 15 to 0 even if you make the "bad" choice at every possible occasion! So I'd be inclined to leave those two lines active.
It does seem to work in the stock game. Edgar Attwood told me that he leaves me when I honored Artois Voysey's request to donate money to the church. Talking to him again enabled me to hire him again, though. I'm thinking that for now those attributes could be disabled, to make sure the character works on a basic level before adding more.

For the 'ch.greeting' line, look at some other characters, see what they have, and copy it from someone suitable. In any case, if there is no "Gr_Rex Hathaway", the worst that I'd expect to happen is what will happen anyway if you don't have that line, which is that you don't hear him say anything when you talk to him. It shouldn't cause a game crash.
Indeed shouldn't cause a crash, just figured it too could be left out for now, but as you say it will probably be the same result.

The line which is causing trouble is almost certainly:
Code:
LAi_SetStayType(CharacterFromID("Rex Hathaway");
Character ID "Rex Hathaway" doesn't exist yet - it is this block in the character file which is going to define it. You can use that in quest code later, but as @Baste says, in this file it should be 'ch', not 'CharacterFromID("Rex Hathaway")'.
Either that and/or that "ch.location.locator" is "goto 16" - it should be "goto16" without a space.
 
My favorite part about this endeavor is how the game TAUNTS me for sucking at scripting, when I open the character menu, it calls me the "Horror of the High Seas" XP I thought that was hilarious!

My favorite part about this endeavor is how the game TAUNTS me for sucking at scripting, when I open the character menu, it calls me the "Horror of the High Seas" XP I thought that was hilarious!
UPDATE! Just tried it, and it seems to be going swimmingly for now, gonna provide another update when I get to Redmond Tavern

1677777605451.png

Ladies and gentlemen, we got him!

Of course, he doesn't say anything, and I'd really much like to have him given the same dialog as any of the other soldiers, I'll get right to work on that though, as one of you DID suggest I copy it from someone else

Also, he's facing the wrong way, though I guess he's probably eyeing down that door in hopes of getting some sleep

Rex, check! Sounds, check! Dialog, works! Now to look into writing the ENTIRE dialog and conversation, and the file itself

Fixed
 

Ladies and gentlemen, we got him!

Of course, he doesn't say anything, and I'd really much like to have him given the same dialog as any of the other soldiers, I'll get right to work on that though, as one of you DID suggest I copy it from someone else

Also, he's facing the wrong way, though I guess he's probably eyeing down that door in hopes of getting some sleep

Rex, check! Sounds, check! Dialog, works! Now to look into writing the ENTIRE dialog and conversation, and the file itself

Fixed
Progress!!! *BENDY SCENE!*

Temporarily moved to Oxbay tavern because I'm sick of the cutscene at the beginning with no way to skip it

More progress!

Progress!!! *BENDY SCENE!*

Temporarily moved to Oxbay tavern because I'm sick of the cutscene at the beginning with no way to skip it

More progress!
In light of this most recent progress update, how do I script the teleporting of the two characters outside to a place and immediately engage in dialog?
 
Last edited:
In light of this most recent progress update, how do I script the teleporting of the two characters outside to a place and immediately engage in dialog?
Teleporting a non-player character:
Code:
ChangeCharacterAddressGroup(characterFromID("Valentin Massoni"), "Oxbay_tavern", "Sit", "Sit5");
Part of the main storyline code, this line puts Valentin Massoni into the tavern so you can meet him and get him to go into the jungle. Replace "Valentin Massoni" with your character's ID, replace "Oxbay_tavern" with "Oxbay_town", replace "Sit" and "Sit5" with the names of the locator group and individual locator where you want him to appear.

Teleporting the player:
Code:
DoQuestReloadToLocation("Greenford_tavern", "Goto", "goto17", "Story_ReturnedToGreenfordTavern");
You've taken Ewan Glover and his soldiers to Gray Rock Bay, fought a battle, and are about to tell Ewan that you have something else to do. Replace "Greenford_tavern" with "Oxbay_town", replace "Goto" and "goto17" with the names of the locator group and individual locator where you want the player to appear, replace "Story_ReturnedToGreenfordTavern" with the name of a new quest case to be run when you're both in place.

Immediate dialog:
Code:
            LAi_SetActorType(CharacterFromID("Insert_Character_ID_Here"));
            Characters[GetCharacterIndex("Insert_Character_ID_Here")].dialog.CurrentNode = "Some_Dialog";
            LAi_ActorDialog(characterFromID("Insert_Character_ID_Here"), PChar, "", 5.0, 5.0);]/code]Replace "Insert_Character_ID_Here" with your character's ID, replace "Some_Dialog" with the dialog case for what he's about to say.  This lot will go into that new quest case which is triggered by the "DoQuestReloadToLocation" line.
 
Teleporting a non-player character:
Code:
ChangeCharacterAddressGroup(characterFromID("Valentin Massoni"), "Oxbay_tavern", "Sit", "Sit5");
Part of the main storyline code, this line puts Valentin Massoni into the tavern so you can meet him and get him to go into the jungle. Replace "Valentin Massoni" with your character's ID, replace "Oxbay_tavern" with "Oxbay_town", replace "Sit" and "Sit5" with the names of the locator group and individual locator where you want him to appear.

Teleporting the player:
Code:
DoQuestReloadToLocation("Greenford_tavern", "Goto", "goto17", "Story_ReturnedToGreenfordTavern");
You've taken Ewan Glover and his soldiers to Gray Rock Bay, fought a battle, and are about to tell Ewan that you have something else to do. Replace "Greenford_tavern" with "Oxbay_town", replace "Goto" and "goto17" with the names of the locator group and individual locator where you want the player to appear, replace "Story_ReturnedToGreenfordTavern" with the name of a new quest case to be run when you're both in place.

Immediate dialog:
Code:
            LAi_SetActorType(CharacterFromID("Insert_Character_ID_Here"));
            Characters[GetCharacterIndex("Insert_Character_ID_Here")].dialog.CurrentNode = "Some_Dialog";
            LAi_ActorDialog(characterFromID("Insert_Character_ID_Here"), PChar, "", 5.0, 5.0);]/code]Replace "Insert_Character_ID_Here" with your character's ID, replace "Some_Dialog" with the dialog case for what he's about to say.  This lot will go into that new quest case which is triggered by the "DoQuestReloadToLocation" line.
Okay? So where would I put these? Do these also go into the dialog.c file? I'm taking a break for the time being, I wanted to share my progress and see what you guys thought, but my motivation plummeted pretty hard... I'll hopefully pick this back up tomorrow

(Unless the links to the videos don't work...)
 
Okay? So where would I put these? Do these also go into the dialog.c file?
No, quest code such as that would go into either "PROGRAM\QUESTS\quests_reaction.c" or "both_reaction.c".

Another thing you could try is to put this into "dialog.c":
Code:
AddDialogExitQuest("rex_prepare_to_leave");
That would probably go somewhere in the same dialog case as 'link.l1.go = "exit";' because that line will trigger quest case "prepare_to_leave" when the dialog ends.

Then, in whichever of "quests_reaction.c" or "both_reaction.c" you are using for quest code:
Code:
case "rex_prepare_to_leave":
    PChar.quest.rex_in_town.win_condition.l1 = "location";
    PChar.quest.rex_in_town.win_condition.l1.character = PChar.id;
    PChar.quest.rex_in_town.win_condition.l1.location = "Oxbay_town";
    PChar.quest.rex_in_town.win_condition = "rex_in_town";
break;

case "rex_in_town":
    ChangeCharacterAddressGroup(CharacterFromID("Rex Hathaway"), "Oxbay_town", "goto", "goto1");
    Characters[GetCharacterIndex("Rex Hathaway")].dialog.CurrentNode = "Some_Dialog";
    LAi_SetStayType(CharacterFromID("Rex Hathaway"));
break;
Replace "Some_Dialog" with the name of a new dialog case in his "dialog.c" file.

So, talking to Rex in the tavern will end by triggering "rex_prepare_to_leave". This sets up a further trigger; when you leave the tavern and return to Oxbay town centre, you trigger "rex_in_town" which puts Rex on locator "goto1", waiting for you to talk to him again. You can choose a different locator if you want him standing somewhere else, such as near the tavern door or behind the tavern.

I'm taking a break for the time being, I wanted to share my progress and see what you guys thought, but my motivation plummeted pretty hard..
The video shows that you're making progress with dialog. :onya Some of it seems to be just place-holders at the moment but at least it's working.
 
No, quest code such as that would go into either "PROGRAM\QUESTS\quests_reaction.c" or "both_reaction.c".

Another thing you could try is to put this into "dialog.c":
Code:
AddDialogExitQuest("rex_prepare_to_leave");
That would probably go somewhere in the same dialog case as 'link.l1.go = "exit";' because that line will trigger quest case "prepare_to_leave" when the dialog ends.

Then, in whichever of "quests_reaction.c" or "both_reaction.c" you are using for quest code:
Code:
case "rex_prepare_to_leave":
    PChar.quest.rex_in_town.win_condition.l1 = "location";
    PChar.quest.rex_in_town.win_condition.l1.character = PChar.id;
    PChar.quest.rex_in_town.win_condition.l1.location = "Oxbay_town";
    PChar.quest.rex_in_town.win_condition = "rex_in_town";
break;

case "rex_in_town":
    ChangeCharacterAddressGroup(CharacterFromID("Rex Hathaway"), "Oxbay_town", "goto", "goto1");
    Characters[GetCharacterIndex("Rex Hathaway")].dialog.CurrentNode = "Some_Dialog";
    LAi_SetStayType(CharacterFromID("Rex Hathaway"));
break;
Replace "Some_Dialog" with the name of a new dialog case in his "dialog.c" file.

So, talking to Rex in the tavern will end by triggering "rex_prepare_to_leave". This sets up a further trigger; when you leave the tavern and return to Oxbay town centre, you trigger "rex_in_town" which puts Rex on locator "goto1", waiting for you to talk to him again. You can choose a different locator if you want him standing somewhere else, such as near the tavern door or behind the tavern.


The video shows that you're making progress with dialog. :onya Some of it seems to be just place-holders at the moment but at least it's working.
He's just in Oxbay for the time being because I got sick of the cutscene when you leave Oxbay, you can't even skip it, so I figured it was gonna take too long, But yeah, thanks for the tips, I'll be back at it probably later today, the sergal can't code without a full tank of fuel, and his coding drink! (Expect a PFP to be available for me)
 
You could put Rex in Redmond. If he's set to be in Redmond tavern in his definition then that's where he'll be waiting for you. Start the game, leave Oxbay, sail to Redmond, then save game. You can then load that saved game whenever you want to test something new with Rex. You will, of course, then need to change all the Oxbay locations in the quest code to Redmond locations!
 
You could put Rex in Redmond. If he's set to be in Redmond tavern in his definition then that's where he'll be waiting for you. Start the game, leave Oxbay, sail to Redmond, then save game. You can then load that saved game whenever you want to test something new with Rex. You will, of course, then need to change all the Oxbay locations in the quest code to Redmond locations!
Every change made to even his dialog requires me to start a new game, doesn't it?
 
No, changes to dialogs should not require a new game. Changes to the character definition will need a new game because character definitions are read at the start of the game, but dialog files are read when you talk to the character. Changing Rex to start in Redmond will need a new game; changing what he says in his dialog will not.

Changes to "quests_reaction.c" or "both_reaction.c" should also not need a new game. You should save game frequently, though, so that you can go back a bit without having to start a new game. In particular, save game just before you are about to talk to Rex. Or, if you have written quest code that will happen in a particular place, save game just before you go to that place.
 
The easiest way to see which items are in the game might be to look in RESOURCE\INI\TEXTS\ENGLISH\ItemsDescribe.txt. There you'll see all the items and their IDs, such as the "Saber" having the ID "blade1". Then in PROGRAM\ITEMS\initItems.c you can search by ID and find the stats for the items.
I don't know what the color and time does, since I haven't seen a difference from changing them.
I'm now thinking to ask... where would I go to modify the starting items container?

Oh yes, I also need to ask, how do I change the sword that's placed down on the tutorial deck...?
 
Last edited:
Can you upload your version of "PROGRAM\QUESTS\both_reaction.c"? I may be able to find the line in there which places one or other of those items.
 
Did you find where the sword is placed on the deck? I don't see that, but items appear to be placed in the chest in case "Tut_start":
Code:
            locations[FindLocation(Pchar.location)].box1.items.pistol1 = 1;
            locations[FindLocation(Pchar.location)].box1.items.spyglass1 = 1;
            locations[FindLocation(Pchar.location)].box1.items.potion1 = 2;
            locations[FindLocation(Pchar.location)].box1.money = 1000;
Look in "PROGRAM\ITEMS\initItems.c" for the ID's of other items you could put in there.
 
Did you find where the sword is placed on the deck? I don't see that, but items appear to be placed in the chest in case "Tut_start":
Code:
            locations[FindLocation(Pchar.location)].box1.items.pistol1 = 1;
            locations[FindLocation(Pchar.location)].box1.items.spyglass1 = 1;
            locations[FindLocation(Pchar.location)].box1.items.potion1 = 2;
            locations[FindLocation(Pchar.location)].box1.money = 1000;
Look in "PROGRAM\ITEMS\initItems.c" for the ID's of other items you could put in there.
It's in the same file, I even searched "blade1" in Sublime, I think I found it! Only one way to be sure...

I haven't found it in the same file, but I'm going to search and search and search... though I could do with some help though

It's in the same file, I even searched "blade1" in Sublime, I think I found it! Only one way to be sure...

I haven't found it in the same file, but I'm going to search and search and search... though I could do with some help though
I FOUND IT!!! HELL YES!!! PROGRAM\Locations\init\QuestLocations.c!!! That's where it is!
 
Last edited:
Back
Top