• 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

If you want your new character to be in a tavern, perhaps the screenshot of him could be taken there? As Grey Roger mentioned if you place him on "goto16" he'll be there. I don't think that locator is ever used by anyone else, so it should be fine to use it.

If you want the 256 picture to be consistent with the pictures for other characters you won't need to add a frame. Only the 128 and 64 pictures have frames in the stock game.

With making him "essential" like in Skyrim and Fallout, do you mean that he shouldn't be able to be killed? That can be done by adding "LAi_SetImmortal(ch, true);" to his code block.

My understanding is that the "Dialog.snd" stuff is for something that was never implemented, so you can safely ignore it and it shouldn't cause any problems.
Ahh okay, good! I was worried there for a moment, and sounds good, but for HIS picture, I want the lighting to be good, so somewhere outside in the daytime oughta work, I suppose?
 
The name I have in mind is "Rex Hathaway", not sure what names were like back then, so I just kinda figured that'd work, he's a soldier for the English Navy, he recently got put on leave by the governor because he "asked too many questions", having heard about the relics and his plans in the Incan temple, so the soldier just kinda hangs out at the tavern until he meets me, which he explains what happened, his theories, and things like that, also asking he can join, of course the dialogue would provide options to say no, to which the soldier will remind me that he'll be there if I change my mind, and the way I would set him up, is he'd be an "essential companion" of sorts. inspired off of Fallout, of course the tradeoff here is he should not be set as a captain of any vessel, if I want English soldiers to captain a vessel, I'll probably use other models/the generic officers, just depends really
A couple of thoughts - feel free to accept, modify or completely ignore them!
The navy would have its own way of dealing with troublemakers. Hathaway might mention that he spent the last few weeks scrubbing the decks or peeling potatoes.

Remember what happens to Raoul Rheims because Silehard suspects him of knowing too much about the relic and the temple? If Silehard arranged for Hathaway to be put on shore leave, it's probably because there's an assassin somewhere...

For interface pictures, there are several suitable places all in or around Redmond town. The outskirts, the jungle beyond, or Rocky Shore beach, could all work well. In town, if you don't want him inside the tavern, put him just outside the tavern instead. Otherwise one nice place is the port, just in front ot the town gate. If you get the character and yourself in the right place, you can get a shot of him framed by a couple of trees, with the rest of the port below and the sea behind.
 
A couple of thoughts - feel free to accept, modify or completely ignore them!
The navy would have its own way of dealing with troublemakers. Hathaway might mention that he spent the last few weeks scrubbing the decks or peeling potatoes.

Remember what happens to Raoul Rheims because Silehard suspects him of knowing too much about the relic and the temple? If Silehard arranged for Hathaway to be put on shore leave, it's probably because there's an assassin somewhere...

For interface pictures, there are several suitable places all in or around Redmond town. The outskirts, the jungle beyond, or Rocky Shore beach, could all work well. In town, if you don't want him inside the tavern, put him just outside the tavern instead. Otherwise one nice place is the port, just in front ot the town gate. If you get the character and yourself in the right place, you can get a shot of him framed by a couple of trees, with the rest of the port below and the sea behind.
Shore leave sounds closest to his story, however, scripting an assassin to appear in the tavern's a bit beyond my own knowledge, I'm already having enough trouble deciphering the dialog.c file for Rex alone, since it's from Rys' original file, I'm not quite sure how to make this one work, but I'm sure at some point I'll get it to work.

Sounds fantastic, in fact, if I take Rex to the Rocky Shore, I think I might have a great angle with my ship and some of the surroundings, though the jungle seems pretty good, too
 
With making him "essential" like in Skyrim and Fallout, do you mean that he shouldn't be able to be killed? That can be done by adding "LAi_SetImmortal(ch, true);" to his code block.
The other part of making him "essential", the way Danielle is protected later in the main story, is to make him unremovable:
Code:
SetCharacterRemovable(ch, false);

If you want to cancel his protection:
Code:
LAi_SetImmortal(ch, false);
SetCharacterRemovable(ch, true);

Another nasty thing Silehard could do is to pay the tavernkeeper a lot of money to keep giving Rex cheap drinks. Nobody is going to take tales of temples and idols seriously if the person telling the tales is permanently drunk - some locals might even buy him more drinks so that he tells them more tales that they can laugh at! If you wanted to do that, all you'd need is to make his first few lines of dialog look almost senseless, then have him sober up and talk more normally after you get him out of the tavern and he's had some fresh air.
 
The other part of making him "essential", the way Danielle is protected later in the main story, is to make him unremovable:
Code:
SetCharacterRemovable(ch, false);

If you want to cancel his protection:
Code:
LAi_SetImmortal(ch, false);
SetCharacterRemovable(ch, true);

Another nasty thing Silehard could do is to pay the tavernkeeper a lot of money to keep giving Rex cheap drinks. Nobody is going to take tales of temples and idols seriously if the person telling the tales is permanently drunk - some locals might even buy him more drinks so that he tells them more tales that they can laugh at! If you wanted to do that, all you'd need is to make his first few lines of dialog look almost senseless, then have him sober up and talk more normally after you get him out of the tavern and he's had some fresh air.
Good idea, I could either make him immortal, or make him unremovable, not sure which I want to do, course, I guess I could always do both

An incredible idea! Because the idea with HIM is that though he's probably the best soldier Silehard has, Rex's resilience can only take so much, and being drunk and telling these stories would make people wonder why's a soldier to begin with. I like this idea a bit more, though again, scripting events like going to a different part of the town, not my forte, and I may need to create locators, too.

I still need to figure out how I'm going to deconstruct and then reconstruct the dialog.c file, what I hope is that there isn't as much to it as I'm leading myself to believe, because it DOES look pretty cryptic though, the .h file, is a different story, THAT'S the easy part, I just need to know what certain things would look like, such as breaking dialog into parts, rather than just having one massive wall of text, and then the various bits to have multiple response choices (Two or more), and that's about it, then the fun part is figuring out how to tie it together with the .c file, should I tackle the C file? Or the H file?
 
Personally I've always figured out what the character is going to say, written the .h file, then written the .c file to put the lines together.

As @Baste previously pointed out, the "dialog.snd" lines don't do anything and can safely be left out. I generally put the whole lot of stuff into case "First time" for reasons of (a) paranoia, due to (b) everyone else seems to have done it. But I never bother with "dialog.snd" anywhere else and my dialogs tend to work (after I've figured out which other silly mistake I made which stopped it from working, and you'll probably soon have some experience of that as well :D).

Generally, the .c file is a list of "case" blocks. At its simplest, this can be something like:
Code:
case "part1":
    dialog.text = DLG_TEXT[2];
    link.l1 = DLG_TEXT[3];
    link.l1.go = "part2";
break;

"dialog.text" is what the character says. It might be "d.text" instead - look for a line somewhere near the top of the .c file which says something like:
Code:
makeref(d, Dialog);
If that's there, and especially if you're modifying an existing file which uses "d.text", continue to use that.

"link.l1" is what you say in response. "link.l1.go" is the next dialog case to follow this one. If this is the end of the conversation then you'll probably have:
Code:
link.l1.go = "exit";

To give the player a choice, use several "link" lines, e.g.:
Code:
case "part2":
    dialog.text = DLG_TEXT[4];
    link.l1 = DLG_TEXT[5];
    link.l1.go = "first choice";
    link.l2 = DLG_TEXT[6];
    link.l2.go = "second choice";
break;
You can have as many choices as you like, though if you have too many, you'll need to scroll down to see the later choices when you talk to the character.

The "DLG_TEXT" lines refer to the .h file. Line 1 of the file is the header, something like:
Code:
string DLG_TEXT[50] = {
Program code starts counting from 0. So the line number in the .h file is usually 2 higher than the "DLG_TEXT" number. "DLG_TEXT[0]" is the second line in the .h file and the first line of actual text after the header.
 
Personally I've always figured out what the character is going to say, written the .h file, then written the .c file to put the lines together.

As @Baste previously pointed out, the "dialog.snd" lines don't do anything and can safely be left out. I generally put the whole lot of stuff into case "First time" for reasons of (a) paranoia, due to (b) everyone else seems to have done it. But I never bother with "dialog.snd" anywhere else and my dialogs tend to work (after I've figured out which other silly mistake I made which stopped it from working, and you'll probably soon have some experience of that as well :D).

Generally, the .c file is a list of "case" blocks. At its simplest, this can be something like:
Code:
case "part1":
    dialog.text = DLG_TEXT[2];
    link.l1 = DLG_TEXT[3];
    link.l1.go = "part2";
break;

"dialog.text" is what the character says. It might be "d.text" instead - look for a line somewhere near the top of the .c file which says something like:
Code:
makeref(d, Dialog);
If that's there, and especially if you're modifying an existing file which uses "d.text", continue to use that.

"link.l1" is what you say in response. "link.l1.go" is the next dialog case to follow this one. If this is the end of the conversation then you'll probably have:
Code:
link.l1.go = "exit";

To give the player a choice, use several "link" lines, e.g.:
Code:
case "part2":
    dialog.text = DLG_TEXT[4];
    link.l1 = DLG_TEXT[5];
    link.l1.go = "first choice";
    link.l2 = DLG_TEXT[6];
    link.l2.go = "second choice";
break;
You can have as many choices as you like, though if you have too many, you'll need to scroll down to see the later choices when you talk to the character.

The "DLG_TEXT" lines refer to the .h file. Line 1 of the file is the header, something like:
Code:
string DLG_TEXT[50] = {
Program code starts counting from 0. So the line number in the .h file is usually 2 higher than the "DLG_TEXT" number. "DLG_TEXT[0]" is the second line in the .h file and the first line of actual text after the header.
Hmmm... seems simple enough, but I don't see a d.text file or a dialog.text, though every character has a .h file for what they say, would that count? Or be what you're referring to? There also seem to be some syntaxes where certain symbols mean something, so like a "." and ! at the beginning of some lines, even some ? are treated as separate entities sometimes, I guess this largely depends on the context?

Just pieced it together, the .c file applies the items on their own, but it's really cryptic using such methods, ah well, I suppose it's something I'll have to get a feel for
 
"d.text" and "dialog.text" aren't files, they're lines in the "dialog.c" file.

The dialog.h files are in "PROGRAM\DIALOGS\ENGLISH". The game code provides for translations into other languages, whose dialog.h files would be in other folders named for those languages. Different languages have different grammars. Where there's just a "." or other punctuation mark, it's because the dialog.c file combines the line before it, something else such as a character's name, and that punctuation mark, so that the result could be something like "I'm going to the ship, Rex." The dialog.h file would contain "I'm going to the ship, " and "." The dialog.c file would insert the character's name in between. That way, if some other language would put something after the name, the translator can add it to the line which in English is just "."

Another thing to watch for is "\n" somewhere in the middle of a line. It's a line break. I don't think it works in any line which you will say (anything to go into a "link.l1"), and my experience is that it doesn't work for the first line of an entire conversation. But it can help to break up a long speech by the character. Ever notice how Governor Silehard's text is broken up and you need to press space to see the next part, for example? Look for "\n" in his dialog.h file...

You will indeed need to learn how dialog.c files work. You'll also need to learn how to figure out why they don't work when you make a typo somewhere - I speak from plenty of experience of that!
 
Makes sense, but the strange part is I don't have any English folders anywhere, which is EXTREMELY bizarre... but it makes sense, I'm gonna have a fun time deconstructing and reconstructing the files, that's for sure...

So change the h file first, then change the C file, understood
 
Where are your .h files, if not in "PROGRAM\DIALOGS\English"?

Perhaps start with a very basic .c file. Here's a minimal one, it's a copy of what I normally use as a starting point for dialogs. The .h file can contain all Rex's possible dialogs (or not, you can always add more later), and the first two lines should be very basic, what he should say routinely if there's nothing special happening. It would be enough for him to say "Hello" and you to say "Hello" back. Put him in Redmond tavern, see if that dialog works, and then build up from there by adding more "case" blocks to handle more dialog lines.
 

Attachments

  • Rex Hathaway_dialog.c
    859 bytes · Views: 41
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
 
Back
Top