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

trying to improve dialog writing

I remember that while I was working on my "Captain Coming Through!" patch for CT, there was one area on a level/map, on a pier, where the only waypoints for the NPCs were further inland. This made the NPCs obstinately walk towards the land -- considering the pier an 'off limits' area (that they were located out of bounds).


I don't remember exactly how, anymore, but I know there is a way of getting those waypoints to show in-game. I remember visually seeing them. They are actually written into the map/level model itself, and you can edit these waypoints with the community's Inez Dias Tool (but you need to gather the co-ordinates in-game first).
 
Last edited:
I thing @Cerez is right. "Muelle04_HouseInsideR6" = residence2 model. See the attached picture of it's walkpatch.
The chair in the top is an isolated light grey small "island".
residence2 patch.jpg
You can maybe use this function instead
Code:
LAi_ActorGoToLocator(Pchar, "box", "box4", "sloop_sailaway4", 12.0);

1 turn the locators on (InternalSettings.h)
2 see if there's a locator somewhere near the "target" character.
3 if not add one
4 if you need help, I'll show you
 
That's interesting. I thought walkpatches are walkpatches, meaning everyone can walk anywhere, as long as the pchar can walk there, or something like that.

What I'm going to do is continue without that for the moment and move it to the back of the process, to the fine tuning. When I get there, I try to fix it again. But if it comes down to it, I could handle it without the autowalk.

The only thing I can say is there are countless locator files for residence2, for example many of them for Woodes Rogers' library. The standard version from the stock game didn't have any goto or sit locators at all. The locator file I have now for Muelle04_HouseInsideR6 does have a lot of them (currently sit2, goto2 and goto3 are occupied, so to talk to the one in sit2, goto4 might do fine) but it also makes the room darker, something about the lighting locators I guess.
 
I thought walkpatches are walkpatches, meaning everyone can walk anywhere, as long as the pchar can walk there, or something like that.
Yes but there could be "islands" for a governor chair or something. In taverns the areas behind the counters are also walkpatches but pchar can't reach them.
(except in WoodesRogers).
 
You can maybe use this function instead

That even works for the walk but then the dialogue doesn't start, maybe because my chosen locator is still too far away. I'll let it be for the moment and continue otherwise.

Next step would be a similar scene at the port, so perhaps it works there.

The only thing that bugs me right now is that I still work in the stock game because it feels easier to play around and test things there before laying hands on the mod. But my stock game is in german so I wrote my dialogue as such and for some reason, the dialogue of some of the new characters doesn't display the letters Ä, Ö, Ü correctly. But I fear you wouldn't know anything about that.
 
You can set the radius of the locator in your questreaction.c for ex with

SetLocatorRadius(locations[FindLocation(Pchar.location)], "box", "box2", 0.1); //changes it directly but resets to normal when you leave the location
Locations[FindLocation("Swamp_island2")].locators_radius.box.box1 = 3.0; //changes it for good but first after a reload to the location
 
//changes it for good but first after a reload to the location
Just to add to this, not sure how POTC handles its saves, but CT will save the location and size of the locators into the save file itself, so in order to see change in the locator(s) you will need to start a new game, and not load from a save file.
 
POTC does that with sea locators, but not with locators on land. You can edit locator files or change locator sizes in quest code and they will show up when you load your savegame. You only need to start a whole new game if the locator is at sea, e.g. a mooring locator near an island.
 
Thank you for all the effort! I dropped the walk-to-character/locator, at least for the moment. It works perfectly fine as it is, the walk would only be an esthetic detail.

Progressing to the next step of the quest I actually have a different problem now.

There are three pirates on a beach. I want to talk to the leader and on exit dialog, fight all three.

This code (based on the hitman quest, currently commented out) worked perfectly:
Code:
                case "Urq_attack":
            //LAi_SetActorType(CharacterFromID("Cesario De Urquiza"));
            //LAi_SetActorType(CharacterFromID("Urq_thug1"));
            //LAi_SetActorType(CharacterFromID("Urq_thug2"));
            //LAi_ActorAttack(CharacterFromID("Cesario De Urquiza"), PChar, "");
            //LAi_ActorAttack(CharacterFromID("Urq_thug1"), PChar, "");
            //LAi_ActorAttack(CharacterFromID("Urq_thug2"), PChar, "");
            LAi_SetCheckMinHP(CharacterFromID("Cesario De Urquiza"), 0.0, 0, "Killed_Urquiza");
        break;
But it doesn't trigger the fight mode with the red blinking icon, and the pirates only attack the player. My officers don't helpt me at all.

So I cobbled together this, based on the EncRaiders:
Code:
                case "Got_instructions":
            AddQuestrecord("castaway", "7");
            ChangeCharacterAddressGroup(characterFromID("Felipe Coya"), "None", "goto", "goto3");
            ChangeCharacterAddressGroup(characterFromID("Cesario De Urquiza"), "Falaise_de_fleur_shore", "goto", "locator24");
            ChangeCharacterAddressGroup(characterFromID("Urq_thug1"), "Falaise_de_fleur_shore", "goto", "citizen04");
            ChangeCharacterAddressGroup(characterFromID("Urq_thug2"), "Falaise_de_fleur_shore", "goto", "locator25");
            LAi_SetWarriorTypeNoGroup(CharacterFromID("Cesario De Urquiza"));
            LAi_SetWarriorTypeNoGroup(CharacterFromID("Urq_thug1"));
            LAi_SetWarriorTypeNoGroup(CharacterFromID("Urq_thug2"));
            LAi_group_MoveCharacter(CharacterFromID("Cesario De Urquiza"), "Urquiza_Group");
            LAi_group_MoveCharacter(CharacterFromID("Urq_thug1"), "Urquiza_Group");
            LAi_group_MoveCharacter(CharacterFromID("Urq_thug2"), "Urquiza_Group");
        break;

                case "Urq_attack":
            LAi_warrior_DialogEnable(CharacterFromID("Cesario De Urquiza"), 0);
            LAi_warrior_DialogEnable(CharacterFromID("Urq_thug1"), 0);
            LAi_warrior_DialogEnable(CharacterFromID("Urq_thug2"), 0);

            LAi_group_FightGroups("Urquiza_Group", LAI_GROUP_PLAYER, 1);
            LAi_group_FightGroups("Urquiza_Group", LAI_GROUP_PLAYER, false);
            LAi_SetCheckMinHP(CharacterFromID("Cesario De Urquiza"), 0.0, 0, "Killed_Urquiza");
        break;
The pirates don't fight, they cower in fear and let themselves slaughter. I don't really understand the whole warrior type stuff, I just based it on the EncRaiders and tried. Also I know there are two different lines of LAi_group_FightGroups, I tried both seperately and together.

And one last thing: Is it possible to base "Killed_Urquiza" at the end on the death (HP = 0) of all three characters, so that "Killed_Urquiza" is triggered when all three are dead in any order? Right now, the following SelfDialog in "Killed_Urquiza" gets triggered as soon as "Cesario De Urquiza" is dead, but his thugs may still be alive.

Thanks!!!
 
If the thugs do not fight, have you given them weapons?

You have moved the thugs plus Cesario de Urquiza himself all into group "Urquiza_group". So to make the fight end when they are all dead:
Code:
LAi_group_SetCheck("Urquiza_group", "Killed_Urquiza");
 
so that "Killed_Urquiza" is triggered when all three are dead in any order?
Yes. Like this:
Code:
Pchar.quest.shya_guards_defeated_check1.win_condition.l1 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l1.character = "wr_sail7";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l2 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l2.character = "wr_snav";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l3 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l3.character = "wr_fsh";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l4 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l4.character = "wr_kor";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l5 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l5.character = "wr_boc4";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l6 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l6.character = "wr_cha";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l7 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l7.character = "wr_cor1";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l8 = "NPC_Death";
            Pchar.quest.shya_guards_defeated_check1.win_condition.l8.character = "wr_cor3";
            Pchar.quest.shya_guards_defeated_check1.win_condition = "shya_guards_defeated_check1";

the case "shya_guards_defeated_check1" is triggered when all 8 enemies are dead. (in any order)

Here's an example of a small fight:
Code:
LAi_group_Register("WR_GUARDS_1");
            LAi_group_MoveCharacter(characterFromID("wr_sail7"), "WR_GUARDS_1");
            LAi_group_MoveCharacter(characterFromID("wench3"), LAI_GROUP_PLAYER);
            LAi_group_SetRelation(LAI_GROUP_PLAYER, "WR_GUARDS_1", LAI_GROUP_ENEMY);
            LAi_group_FightGroups(LAI_GROUP_PLAYER, "WR_GUARDS_1", true);

1 the enemy group is defined
2 the enemies (only "wr_sail7" here) are given a group
3 the allies (only "wench3") are given a group
4 set relation between groups
5 groups fight

I have had a lot of problems making these fights to work perfect. The order of those steps is important.
I don't remember at the moment but think your officers behave by themselves. (without any group)
 
Thanks, I will keep trying. This should be such a common case of gameplay, I'm surprised it isn't that easy.

They have weapons, and as I said if I set all three to Actor and then use ActorAttack, the fight happens but because that doesn't trigger the "official" fight mode, officers won't help me in the fight.

With the fight group, officers help me but the enemy doesn't fight back.

What's really strange is after I kill them, when I fire an officer he attacks me.
 
Quick update, I went closer with the Pepin Bertillon code in the hitman quest, because that's the scene I've been looking to do. With a similar sctructure and order of the code, it all works fine. My only nitpick is that the pirates are now walking around the beach, I intended them to stand still, but so what, makes no difference.

My next step would be a sea battle, so I have the feeling I might be dependant on your help once again soon enough...
 
If they walk around they are maybe set to citizentype? Could be changed to staytype.
 
No they're set to WarriorType now, I didn't really know about that one before but it's part of the code that makes the whole fight work the way I wanted it (pirates fight back, officers help player, officers don't attack player when fired after fight).

They're StayType in the character file, but the quest code sets them to WarriorType now.
 
If they're looking for enemies, it makes sense for them to walk around, to patrol the area, as that's the only way they can spot the player. ("Warrior" stands for soldier in the code.)

I suppose you could make them StayType until the player reaches a certain close proximity area, at which point you could switch them to WarriorType, and direct them to charge at the player.

(Not sure what it is exactly that you are actually trying to accomplish for this quest.)
 
I think that will be because soldiers were designed for group alignments when it comes to the AI, in controlling their behaviour. :beer:
 
Cutscenes tend to distract from the gameplay experience -- to take you out of the imaginative personal story you were living.
Sometimes I like cutscenes. Used well, they can make the experience feel more filmic.
But the PotC game engine doesn't really lend itself to that very well...

I don't remember exactly how, anymore, but I know there is a way of getting those waypoints to show in-game. I remember visually seeing them.
In PROGRAM\Locations\locations_loader.c are "VisibleLocatorsGroup" lines.
Those make them visible.
I think those lines are there in AoP:CT and CoAS too.

In PotC New Horizons, you can more easily enable them at the bottom of PROGRAM\InternalSettings.h with:
Code:
#define VISIBLE_LOCATORS               0
#define WITH_BRIGHT_COLOURS               0       // VISIBLE_LOCATORS must be on to change this

POTC does that with sea locators, but not with locators on land. You can edit locator files or change locator sizes in quest code and they will show up when you load your savegame. You only need to start a whole new game if the locator is at sea, e.g. a mooring locator near an island.
Location locator coordinates are loaded along with the 3D scene, so don't require any code work.
Radius does require code stuff.

There is probably a way to set sea locators through code too.
But it's certainly less straightforward .
 
Back
Top