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

Need Help Modifiyng Freeplay

I'm not sure. Try creating new dialog files for them rather than relying on "Enc_Officer_dialog.c".
I'll try, but I think I did that before but it didn't work. Nevertheless, I'll try again.

Why would Governor Silehard make his daughter an officer? She's not a sailor, and in any case is romantically involved with a Spanish officer and liable to leave home. Silehard's main naval officer in "Tales of a Sea Hawk" is Waulter Tomlison, though he has a ship of his own. Otherwise just make "Malcolm Hatcher" a regular naval officer, the same as if you FreePlay as a naval officer. The male voice and sword will no longer be a problem.
I was actually thinking the same thing. In fact, I'd like to make Tomlison a Freeplay character, but he doesn't have a unique model so I don't know what to assign him to. In any case, the idea was for an easier reference to the story of the original game, with the Da Saldanha quest. for those who were familiar with these characters. But fine, if there's no alternative, I guess Tomlison will do.

I'm not sure. The best move is not to teleport to the governor's residence. If you start on board your ship then you'll come ashore in the port, after which you can walk to the residence. (Presumably you've removed "John Clifford Brin", the default governor character in Port Royale residence?)
Alright, I'll just teleport to the port. Then maybe try to assign a soldier there that asks if you want to be accompanied to the mansion, to which you refuse.
That is to be expected. You have captured the colonies for yourself rather than leaving them as British colonies. This is not entirely unreasonable as Silehard is corrupt, and as Nathaniel Hawk in "Tales of a Sea Hawk", you eventually bring him to justice in front of the replacement governor. So, if you want to be the corrupt Silehard, face the consequences - Britain wants you to hang!

Corrupt as he was, no one knew in the start anyway. He successfully defeated the French with the help of some of Britain's most competent agents and navymen. So I was thinking of a Freeplay that puts you into the shoes of this Silehard, not the one that got ratted out to Brin after his defeat under Nathaniel. I was also thinking of setting relations to Pirates to Neutral, given that he's in contact with Jurcksen, but I don't know the code for that...

Alternatively, perhaps you want a start where Silehard beat Nathaniel and got the treasure, then proceeded to take Redmond by force with his first rate? Maybe I could try to generate an enemy British fleet right at the harbour which you'll be forced to repel with a damaged manowar or something like in the Greenford battle. You could even have Jurcksen as officer...

Which reminds me, what did the guy even do to turn on England anyway? After all, the treasure quest was just a personal affair.

In any case, I'd still like to know if it's possible to own a colony while it keeps its original nation, because I might want to try it out with the other governors.
 
Last edited:
I'll try, but I think I did that before but it didn't work. Nevertheless, I'll try again.
How exactly are you making "DarkCaptainFP" and "GarethFP" into officers?

I was actually thinking the same thing. In fact, I'd like to make Tomlison a Freeplay character, but he doesn't have a unique model so I don't know what to assign him to. In any case, the idea was for an easier reference to the story of the original game, with the Da Saldanha quest. for those who were familiar with these characters. But fine, if there's no alternative, I guess Tomlison will do.
You can already FreePlay Tomlison. Just set the FreePlay year to 1740, pick a naval officer outfit, and rename yourself as Waulter Tomlison. You could probably take a look at "PROGRAM\NK.c", see how some other characters are set up, and arrange for suitable ships for Tomlison through his career. In particular, when he reaches rank 6, give him ship type "Battleship4" named "Vengeance" because that's what he commands in "Tales of a Sea Hawk" during Silehard's counter-attack on Bridgetown.

The Lucas da Saldanha quest is exactly why Arabella Silehard should not be an officer! She's defined as a character in "PROGRAM\Characters\init\SideQuest.c" so you can perhaps teleport her to the residence. Of course, if you then choose to do the Lucas da Saldanha quest, she'll disappear, but that quest is going to look silly if you're playing as Silehard anyway. In fact, most of the game is going to look silly, starting with the concept of the governor having his own ship and sailing off instead of staying at home to do his job, and then asking another governor for a Letter of Marque. xD

Alright, I'll just teleport to the port. Then maybe try to assign a soldier there that asks if you want to be accompanied to the mansion, to which you refuse.
You shouldn't need to teleport to the port. If you're doing a custom start as a British character, you'll probably start there anyway.

Corrupt as he was, no one knew in the start anyway. He successfully defeated the French with the help of some of Britain's most competent agents and navymen. So I was thinking of a Freeplay that puts you into the shoes of this Silehard, not the one that got ratted out to Brin after his defeat under Nathaniel. I was also thinking of setting relations to Pirates to Neutral, given that he's in contact with Jurcksen, but I don't know the code for that...
Ewan Glover suspected that Silehard was up to no good, though you never have the chance to follow up on his suspicions. One reason Speightstown was captured in the first place was that instead of using his most powerful, newest warship to defend it, Silehard sent the ship off on his personal treasure quest.

To become neutral to Pirates, try:
Code:
RMAmnesty(PChar, PIRATES);
 
How exactly are you making "DarkCaptainFP" and "GarethFP" into officers?


You can already FreePlay Tomlison. Just set the FreePlay year to 1740, pick a naval officer outfit, and rename yourself as Waulter Tomlison. You could probably take a look at "PROGRAM\NK.c", see how some other characters are set up, and arrange for suitable ships for Tomlison through his career. In particular, when he reaches rank 6, give him ship type "Battleship4" named "Vengeance" because that's what he commands in "Tales of a Sea Hawk" during Silehard's counter-attack on Bridgetown.

The Lucas da Saldanha quest is exactly why Arabella Silehard should not be an officer! She's defined as a character in "PROGRAM\Characters\init\SideQuest.c" so you can perhaps teleport her to the residence. Of course, if you then choose to do the Lucas da Saldanha quest, she'll disappear, but that quest is going to look silly if you're playing as Silehard anyway. In fact, most of the game is going to look silly, starting with the concept of the governor having his own ship and sailing off instead of staying at home to do his job, and then asking another governor for a Letter of Marque. xD


You shouldn't need to teleport to the port. If you're doing a custom start as a British character, you'll probably start there anyway.


Ewan Glover suspected that Silehard was up to no good, though you never have the chance to follow up on his suspicions. One reason Speightstown was captured in the first place was that instead of using his most powerful, newest warship to defend it, Silehard sent the ship off on his personal treasure quest.

To become neutral to Pirates, try:
Code:
RMAmnesty(PChar, PIRATES);
I found a way to fix the voice - it was all in ch.greeting after all!

So, now I've put Arabella in the "Redmond Residence Study" instead - that is the room I placed beyond the door on the ground level. This Arabella's ID is the same as the one in the SideQuest file, but her name appears as "Arabella Moore" instead - is there some mechanism that causes character's last names to change if you set yours to one that's identical to theirs?
 
I found a way to fix the voice - it was all in ch.greeting after all!

So, now I've put Arabella in the "Redmond Residence Study" instead - that is the room I placed beyond the door on the ground level. This Arabella's ID is the same as the one in the SideQuest file, but her name appears as "Arabella Moore" instead - is there some mechanism that causes character's last names to change if you set yours to one that's identical to theirs?
No, there's a mechanism to cause Arabella's last name to change to that of the true governor of Port Royale, which in "Colonial Powers" period is Sir Henry Moore. Then "Tales of a Sea Hawk" changes her name back to "Silehard" because Sir Robert Christopher Silehard really is governor in that story.

Put this somewhere in your quest code:
Code:
Characters[GetCharacterIndex("Arabella Silehard")].lastname = TranslateString("", "Silehard");
 
So, your changes to the animist boarders worked. Brilliant! Even the crewmen I bring ashore are robed. :)

Some shots:

animists1.jpg




animists2.jpg


animists3.jpg

I suppose this'll do for my intentions for the "animist" Freeplay for now. Of course it wouldn't at all be possible without your help! I guess I could say that for once I finally added something to this game.

So I'll try to tamper with a few others as much as I am able, and as far as you'll be willing to assist...

Currently, I'm playing around with Silehard and Sparrow Freeplays. So there's an Arabella Silehard character in the "Study" along with her maid. Her last name is now correct! I'm not sure what I can do with this maid, but I wanted to give her some dialog that would allow me to "sleep" in the bedroom upstairs (similar to the tavern), since it's kind of odd to choose to sleep in the tavern if you're the governor - looking at dialog files though, makes my head spin.

For now though, I have four issues:

1 - I've tried to set the soldiers' relation to Silehard to be "Neutral" or "Friendly" but they still attack me when I attack them. This is the code I placed under case hubeng_continue:

LAi_group_SetAlarmReaction("ENGLAND_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_FRIEND, LAI_GROUP_FRIEND);

2 - Despite trying to remove Joaquin Da Saldanha from the Silehard Freeplay, he still appears in the San Juan townhall. Here's what I put:

case "hubeng_Continue":
SetQuestHeader("Beginning_Hubeng");
ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "none", "", "");
ChangeCharacterAddressGroup(CharacterFromID("Joaquin Da Saldanha"), "none", "", "");

3 - I gave Sparrow a flintlock pistol and bosun's choice in characters_init.c. I also placed a code to remove the starting horse pistol and cheap spyglass. Strangely enough, upon arriving in port, I'm armed with what appears to be a horse pistol, but it doesn't show up in the Inventory! What shows up in the Inventory is the flintlock, but it isn't equipped despite me putting a code for that.

After arming the flintlock, the horse pistol can no longer be used, because it's not in the Inventory and I can't equip it. Likewise, the cheap spyglass is removed, but the common spyglass that I assigned is nowhere to be seen. Weird.

Here's case "Jack Sparrow" under case "Avergorex" in characters_init.c:

case "Jack Sparrow":
ch.shiplog.Entry.log0 = "After escaping from Port Royal, we've arrived back at Tortuga. With the Pearl back, freedom lies ahead once more.";
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "spyglass2");
EquipCharacterByItem(ch, "spyglass2");
GiveItem2Character(ch, "compass1");
EquipCharacterByItem(ch, "compass1");
GiveItem2Character(ch, "clock1");
EquipCharacterByItem(ch, "clock1");
GiveItem2Character(ch, "sextant");
EquipCharacterByItem(ch, "sextant");
GiveItem2Character(ch, "blade27");
ch.equip.blade = "blade27";
GiveItem2Character(ch, "PiratesPistol");
ch.equip.gun = (ch, "PiratesPistol");
GiveItem2Character(ch, "aztec_compass");
GiveItem2Character(ch, "mapHispaniola");
GiveItem2Character(ch, "mapQuebradasCostillas");
GiveItem2Character(ch, "mapTurks");
//GiveModel2Player("depp",true);
ch.Gibbs = 1;
break;

As an aside, is there a way to add outfits to your character? The GiveModel2Player seems to only replace what you have, not add to it.

4 - Sparrow won't teleport to Tortuga despite me putting this in both_reaction.c within the case Custom_Start part:

case PIRATE:
if (CheckCharacterItem(PChar, "aztec_compass") && PChar.model == "Jack")
{
loadPort = "Tortuga_Port";
gotoGroup = "reload";
rldLocator = "reload2_back";
}
if (CheckCharacterItem(PChar, "animists_amulet") && PChar.model == "Animists1")
{
loadPort = "Muelle_shore_02";
gotoGroup = "reload";
rldLocator = "see";
}
else
{
loadPort = "QC_port";
gotoGroup = "reload";
rldLocator = "reload1";
}
break;

Hmm...any solutions?
 
Last edited:
So, your changes to the animist boarders worked. Brilliant! Even the crewmen I bring ashore are robed. :)

Some shots:


I suppose this'll do for my intentions for the "animist" Freeplay for now. Of course it wouldn't at all be possible without your help! I guess I could say that for once I finally added something to this game.

So I'll try to tamper with a few others as much as I am able, and as far as you'll be willing to assist...

Currently, I'm playing around with Silehard and Sparrow Freeplays. So there's an Arabella Silehard character in the "Study" along with her maid. Her last name is now correct! I'm not sure what I can do with this maid, but I wanted to give her some dialog that would allow me to "sleep" in the bedroom upstairs (similar to the tavern), since it's kind of odd to choose to sleep in the tavern if you're the governor - looking at dialog files though, makes my head spin.

For now though, I have four issues:

1 - I've tried to set the soldiers' relation to Silehard to be "Neutral" or "Friendly" but they still attack me when I attack them. This is the code I placed under case hubeng_continue:

LAi_group_SetAlarmReaction("ENGLAND_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_FRIEND, LAI_GROUP_FRIEND);

2 - Despite trying to remove Joaquin Da Saldanha from the Silehard Freeplay, he still appears in the San Juan townhall. Here's what I put:

case "hubeng_Continue":
SetQuestHeader("Beginning_Hubeng");
ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "none", "", "");
ChangeCharacterAddressGroup(CharacterFromID("Joaquin Da Saldanha"), "none", "", "");

3 - I gave Sparrow a flintlock pistol and bosun's choice in characters_init.c. I also placed a code to remove the starting horse pistol and cheap spyglass. Strangely enough, upon arriving in port, I'm armed with what appears to be a horse pistol, but it doesn't show up in the Inventory! What shows up in the Inventory is the flintlock, but it isn't equipped despite me putting a code for that.

After arming the flintlock, the horse pistol can no longer be used, because it's not in the Inventory and I can't equip it. Likewise, the cheap spyglass is removed, but the common spyglass that I assigned is nowhere to be seen. Weird.

Here's case "Jack Sparrow" under case "Avergorex" in characters_init.c:

case "Jack Sparrow":
ch.shiplog.Entry.log0 = "After escaping from Port Royal, we've arrived back at Tortuga. With the Pearl back, freedom lies ahead once more.";
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "spyglass2");
EquipCharacterByItem(ch, "spyglass2");
GiveItem2Character(ch, "compass1");
EquipCharacterByItem(ch, "compass1");
GiveItem2Character(ch, "clock1");
EquipCharacterByItem(ch, "clock1");
GiveItem2Character(ch, "sextant");
EquipCharacterByItem(ch, "sextant");
GiveItem2Character(ch, "blade27");
ch.equip.blade = "blade27";
GiveItem2Character(ch, "PiratesPistol");
ch.equip.gun = (ch, "PiratesPistol");
GiveItem2Character(ch, "aztec_compass");
GiveItem2Character(ch, "mapHispaniola");
GiveItem2Character(ch, "mapQuebradasCostillas");
GiveItem2Character(ch, "mapTurks");
//GiveModel2Player("depp",true);
ch.Gibbs = 1;
break;

As an aside, is there a way to add outfits to your character? The GiveModel2Player seems to only replace what you have, not add to it.

4 - Sparrow won't teleport to Tortuga despite me putting this in both_reaction.c within the case Custom_Start part:

case PIRATE:
if (CheckCharacterItem(PChar, "aztec_compass") && PChar.model == "Jack")
{
loadPort = "Tortuga_Port";
gotoGroup = "reload";
rldLocator = "reload2_back";
}
if (CheckCharacterItem(PChar, "animists_amulet") && PChar.model == "Animists1")
{
loadPort = "Muelle_shore_02";
gotoGroup = "reload";
rldLocator = "see";
}
else
{
loadPort = "QC_port";
gotoGroup = "reload";
rldLocator = "reload1";
}
break;

Hmm...any solutions?
Ignore #3, I found a way to fix it in characters_init.c.
 
1: Of course the soldiers will attack you when you attack them! They're not much use as soldiers if they won't defend themselves. I would imagine that if President Biden grabbed a gun and started shooting at the guards outside the White House, they'd fight back. The basic problem is that you're not really governor of Port Royale, you've just abducted the real governor and usurped his position. And so you can get in a ship and go to sea instead of staying in the town hall doing a governor's work, while the entire rest of the Caribbean refuses to recognise you as governor. (Doing all the necessary code work to make PChar a proper governor would probably break things and is not recommended!)

2: Joaquin Da Saldanha is originally not placed at all. Whenever you enter San Juan town hall, a check is made on your character level; if you're at least level 4, that's when Joaquin Da Saldanha is placed in the town hall. FreePlay starts at level 5. (Some storylines start at level 1 so you need to play a bit and advance to level 4 before he shows up and you can take the quest.) Try this:
Code:
PChar.quest.Luc_start.over = "yes";
If that doesn't stop the quest, add this as well:
Code:
DeleteEnterLocationQuest("Muelle_residence", "Luc_start_check");

3, 4: I wouldn't advise doing much with Jack Sparrow. He has his own entire storyline! Anyone who wants to FreePlay as Jack Sparrow probably just wants either the outfit or the Black Pearl without bothering about the films. Perhaps start him off at Tortuga but don't bother changing his equipment or outfit. As for starting him off at Tortuga, that code logic is faulty. First, if you have the "Jack" outfit and the compass, you're set to teleport to Tortuga. Then, if you have the Animist outfit and medallion, you teleport to their island, otherwise you teleport to Nevis. That overrides the attempt to send Jack to Tortuga. Try this:
Code:
case PIRATE:
        loadPort = "QC_port";
        gotoGroup = "reload";
        rldLocator = "reload1";
        if (PChar.model == "Jack" && GetMySimpleName(PChar) == "Jack Sparrow")
        {
                loadPort = "Tortuga_Port";
                gotoGroup = "reload";
                rldLocator = "reload2_back";
        }
        if (CheckCharacterItem(PChar, "animists_amulet") && PChar.model == "Animists1")
        {
                loadPort = "Muelle_shore_02";
                gotoGroup = "reload";
                rldLocator = "see";
        }
 break;
That should send you to Nevis by default, to Tortuga if you're Jack, and to the island if you're Animist. The check for being Jack Sparrow changes to checking your outfit and your name - Jack Sparrow can get the compass the same way as anyone else, by talking to Joshamee Gibbs in Tortuga tavern. (Which means delete the lines 'GiveItem2Character(ch, "aztec_compass")' and 'ch.Gibbs = 1'.)

'GiveModel2Character' should add the outfit to your list. It will also put you into that outfit if its second argument is 'true'. For example, in "StartStoryline.c", if you choose to play as Milady de Winter:
Code:
            if (PChar.model == "Milady") GiveModel2Player("Milady2",false);
            if (PChar.model == "Milady2") GiveModel2Player("Milady",false);
If you picked her dress outfit then you get her undercover outfit as well, and vice versa. Because it's set to 'false', the additional outfit doesn't replace the one you originally chose, it just shows up in your outfits list so you can switch between them whenever you like. By contrast, in "PROGRAM\Storyline\JackSparrow\quests\quests_reaction.c":
Code:
            GiveModel2Player("47YoungJack",true);
            GiveModel2Player("depp",false);
This is almost right at the beginning, when you become young Jack Sparrow starting out at Cayman. You get his young captain's outfit, and 'true' means you're wearing it. You also get his piratical outfit, and 'false' means you're not wearing it. Both go into your outfits list so you can switch between them when you want to.

Incidentally, if you want to give several of one item to a character, don't use 'GiveItem2Character'. Use 'TakeNItems'. For example, this:
Code:
TakeNItems(ch, "medical1", 8);
... does the same as this:
Code:
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
GiveItem2Character(ch, "medical1");
 
1: Of course the soldiers will attack you when you attack them! They're not much use as soldiers if they won't defend themselves. I would imagine that if President Biden grabbed a gun and started shooting at the guards outside the White House, they'd fight back. The basic problem is that you're not really governor of Port Royale, you've just abducted the real governor and usurped his position. And so you can get in a ship and go to sea instead of staying in the town hall doing a governor's work, while the entire rest of the Caribbean refuses to recognise you as governor. (Doing all the necessary code work to make PChar a proper governor would probably break things and is not recommended!)

Fortunately it looks like I've managed to set Redmond, Greenford, and Oxbay as my "colonies" through SetTownNation. So now, I get taxes from them!

The reason why I thought of making the soldiers "friends" is because after killing one of them, the "reinforcements" that arrive wear Personal_Soldier uniforms, and attack the previous guards which I'd pissed off (who are wearing red coats!). So as you can imagine, this is kinda odd and inconsistent...I would really like to know if there's a way around this.

Two more things that bug me:

- I like to set up starting officers for the Freeplays I'm working on. So for instance, Silehard gets two guards at the start who are supposed to have all the fighting perks researched, but whenever I put them into my active officers list, these perks are removed! Here's the thing - the guards are set to become my active officers through Start Storyline, which means the moment I arrive in port, they appear. So at this very moment their perks are already gone. If I just set them as passengers, the perks do appear - but when I make them "active", they go away! Similarly, Gibbs and Anamaria are set as Passengers for my Jack Sparrow freeplay, and have some perks researched in Officers.c, but the moment I activate them the perks are reset...this is despite their skill points and hitpoints working the way I assigned them, also in the Officers.c file.

Start Storyline:
if (GetMySimpleOldName(PChar) == "Robert Christopher Silehard" && PChar.model == "huber_eng")
{
SetOfficersIndex(Pchar, 1, GetCharacterIndex("EngBodyguard1")); // NK was -1
//LAi_SetOfficerType(characterFromID("EngBodyguard1"));
characters[GetCharacterIndex("EngBodyguard1")].Dialog.Filename = "Enc_Officer_dialog.c"; // KK
characters[GetCharacterIndex("EngBodyguard1")].Dialog.CurrentNode = "Hired"; // KK
SetOfficersIndex(Pchar, 2, GetCharacterIndex("EngBodyguard2")); // NK was -1
//LAi_SetOfficerType(characterFromID("EngBodyguard2"));
characters[GetCharacterIndex("EngBodyguard2")].Dialog.Filename = "Enc_Officer_dialog.c"; // KK
characters[GetCharacterIndex("EngBodyguard2")].Dialog.CurrentNode = "Hired"; // KK
}

Officers.c:
ch.old.name = "";
ch.old.lastname = "";
ch.name = TranslateString("", "Bodyguard");
ch.lastname = TranslateString("", "");
ch.id = "EngBodyguard1";
ch.model = Nations[England].fantomModel.m0; // PB
ch.sex = "man";
ch.sound_type = "seaman";
LAi_NoRebirthEnable(ch);
ch.nation = England;
GiveItem2Character(ch, "bladeC30");
ch.equip.blade = "bladeC30";
GiveItem2Character(ch, "LongRifle_H");
ch.equip.gun = "LongRifle_H";
GiveItem2Character(ch, "commonarmor");
if (ENABLE_AMMOMOD) { // LDH change
TakenItems(ch, "gunpowder", 30);
TakenItems(ch, "pistolbullets", 30);
}
TakenItems(ch, "medical1", 40);
ch.perks.list.BasicDefence = true;
ch.perks.list.AdvancedDefence = true;
ch.perks.list.SwordplayProfessional = true;
ch.perks.list.CriticalHit = true;
ch.Perks.list.Toughness = true;
ch.Perks.list.Gunman = true;
ch.Perks.list.ImproveAiming = true;
ch.Perks.list.GunProfessional = true;
ch.Perks.list.GunFighter = true;
ch.nodisarm = 1; // PB: Disable disarming
ch.location = "none";
ch.location.group = "";
ch.location.locator = "";
ch.Dialog.Filename = "Mergildo Hurtado_dialog.c";
// KNB ch.Ship.Cannons.Type = CANNON_TYPE_CANNON_LBS24;
ch.rank = 1;
ch.reputation = "60";
ch.experience = "0";
ch.skill.Leadership = "6";
ch.skill.Fencing = "10";
ch.skill.Sailing = "1";
ch.skill.Accuracy = "1";
ch.skill.Cannons = "1";
ch.skill.Grappling = "1";
ch.skill.Repair = "1";
ch.skill.Defence = "1";
ch.skill.Commerce = "1";
ch.skill.Sneak = "8";
ch.money = "10";
LAi_SetLoginTime(ch, 0.0, 24.0);
LAi_SetHP(ch, 80.0, 80.0);
ch.quest.officertype = OFFIC_TYPE_GUARD;
ch.isOfficer = true;
ch.greeting = "Gr_Redmond Soldier";
ch.questchar = true;//MAXIMUS: identifier for captives
AddGameCharacter(n, ch);

- In the Sparrow storyline, I tried to set up Norrington's Dauntless by the front of the Port Royal harbour, which means it's supposed to be "guarding" the fort. I used Quest_ships_10 for the locator, but it appears in a different area. Plus, I want this ship and the Redmond fort, as well as the Redmond soldiers, to attack me without mercy even while I'm using the British flag, because as long as I'm using the Black Pearl, I'm supposed to be hunted down. Yet none of this works ingame.

both_reaction.c:
Group_CreateGroup("RedmondFort");
Group_CreateGroup("Norrington");
Group_AddCharacter("RedmondFort", "Redmond Commander");
Group_AddCharacter("Norrington", "NorringtonJackFP");
Group_SetGroupCommander("RedmondFort", "Redmond Commander");
Group_SetGroupCommander("Norrington", "NorringtonJackFP");
Group_SetAddress("Norrington", "Redmond", "Quest_Ships","Quest_Ship_10");
Group_SetTaskAttack("RedmondFort", PLAYER_GROUP, true);
Group_SetTaskAttack("Norrington", PLAYER_GROUP, true);
Group_LockTask("RedmondFort");
Group_LockTask("Norrington");
AddQuestRecord("Beginning_CapJackSparrowFP", 1);
CloseQuestHeader("Beginning_CapJackSparrowFP");

Incidentally, would you know of a way to make Norrington chase me several times through a span of say 2 years, until I sink him or am granted amnesty to England? I was thinking that while at the World Map or in Open Sea, the Dauntless would appear randomly to attack you, since I'm trying to simulate the part of the story where Norrington gave Jack 1 day's head start, then continued to pursue him.
 

Attachments

  • both_reaction.c
    175 KB · Views: 53
  • StartStoryline.c
    60.9 KB · Views: 55
  • Officers.c
    32 KB · Views: 59
Fortunately it looks like I've managed to set Redmond, Greenford, and Oxbay as my "colonies" through SetTownNation. So now, I get taxes from them!

The reason why I thought of making the soldiers "friends" is because after killing one of them, the "reinforcements" that arrive wear Personal_Soldier uniforms, and attack the previous guards which I'd pissed off (who are wearing red coats!). So as you can imagine, this is kinda odd and inconsistent...I would really like to know if there's a way around this.
Use 'CaptureTownForNation("REDMOND", PERSONAL_NATION)' instead. Or 'CaptureColony("REDMOND", PERSONAL_NATION)', which is how Bridgetown is captured for you in "Tales of a Sea Hawk". That should set the town's soldiers to Personal. They might even then refuse to fight you.

Two more things that bug me:

- I like to set up starting officers for the Freeplays I'm working on. So for instance, Silehard gets two guards at the start who are supposed to have all the fighting perks researched, but whenever I put them into my active officers list, these perks are removed! Here's the thing - the guards are set to become my active officers through Start Storyline, which means the moment I arrive in port, they appear. So at this very moment their perks are already gone. If I just set them as passengers, the perks do appear - but when I make them "active", they go away! Similarly, Gibbs and Anamaria are set as Passengers for my Jack Sparrow freeplay, and have some perks researched in Officers.c, but the moment I activate them the perks are reset...this is despite their skill points and hitpoints working the way I assigned them, also in the Officers.c file.
Don't assign Gibbs as an officer. You meet him in Tortuga tavern and he gives you the Aztec compass. Any character can meet him there, but it's especially appropriate for Jack Sparrow. And don't assign Anamaria because you'll find her wandering around Tortuga and you'll get slapped if you talk to her. She's not a character you can remove, either; she's part of the code for various things going on in Tortuga.

The levelling system obeys "questchar" for skills but seems to ignore it for perks. See what happens if you assign the perks in "StartStoryline.c", e.g.:
Code:
characters[GetCharacterIndex("EngBodyguard1")].perks.list.BasicDefence = true;

- In the Sparrow storyline, I tried to set up Norrington's Dauntless by the front of the Port Royal harbour, which means it's supposed to be "guarding" the fort. I used Quest_ships_10 for the locator, but it appears in a different area. Plus, I want this ship and the Redmond fort, as well as the Redmond soldiers, to attack me without mercy even while I'm using the British flag, because as long as I'm using the Black Pearl, I'm supposed to be hunted down. Yet none of this works ingame.
They won't attack you if they're Personal. Britain probably doesn't like you if you've taken over three of its colonies, so if you make Norrington British, he'll probably attack you regardless of what ship you're using. If you fly a pirate flag they will probably also attack you, again regardless of which ship you're sailing. I don't know of any mechanism to make anyone hostile because you're using a particular ship.

Incidentally, would you know of a way to make Norrington chase me several times through a span of say 2 years, until I sink him or am granted amnesty to England? I was thinking that while at the World Map or in Open Sea, the Dauntless would appear randomly to attack you, since I'm trying to simulate the part of the story where Norrington gave Jack 1 day's head start, then continued to pursue him.
I've no idea how to make someone chase you on the worldmap or open sea. Easier would be to have Norrington appear when you approach a particular island, though still tricky. You're going to need to learn how to write quests. And for that, you should first try playing a storyline or two, then look at their quest code to see how they work. The "Hornblower", "Assassin" and "Bartolomeu" storylines are easiest to follow.
 
Use 'CaptureTownForNation("REDMOND", PERSONAL_NATION)' instead. Or 'CaptureColony("REDMOND", PERSONAL_NATION)', which is how Bridgetown is captured for you in "Tales of a Sea Hawk". That should set the town's soldiers to Personal. They might even then refuse to fight you.
I tried to do that, but what I don't like is that they wear Personal Soldier uniforms. They should be wearing British soldier uniforms - I'm supposed to be governor of a British colony, not a personal one.

Strangely enough, the port guards don't fight back when I attack them. But they're the only ones to respond this way in Redmond - every other soldier attacks me. The guys by the mansion attack me. By the church attack me. What's really weird to me is why they are so aggressive despite me setting for them the exact same code I did to the cave animists in the other Freeplay, which ended the way I wanted (that is, no one attacks me even if I hit them!). Compare:

case "Animist_Continue":
Island_SetReloadEnableLocal("IslaMuelle", "reload_2", true);
SetQuestHeader("Beginning_Animist");
Nations_SetAllHostile();
ChangeCharacterAddressGroup(CharacterFromID("Dark Teacher"), "none", "", "");
ChangeCharacterAddressGroup(CharacterFromID("Rian Dekkers"), "none", "", "");
ChangeCharacterAddressGroup(CharacterFromID("Janneke Blinkerhof"), "none", "", "");
ChangeCharacterAddressGroup(CharacterFromID("Lisebet Schefold"), "none", "", "");
ChangeCharacterAddressGroup(CharacterFromID("Gheraed Drabbe"), "none", "", "");
LAi_SetImmortal(CharacterFromID("ANIMISTS_01"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_02"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_03"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_04"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_05"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_06"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_07"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_08"), true);
LAi_SetImmortal(CharacterFromID("ANIMISTS_09"), true);
LAi_group_SetAlarmReaction("ANIMISTS_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_FRIEND, LAI_GROUP_FRIEND);

To:

case "hubeng_Continue":
SetQuestHeader("Beginning_Hubeng");
ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "none", "", "");
ChangeCharacterAddressGroup(CharacterFromID("Joaquin Da Saldanha"), "none", "", "");
SetTownNation("Redmond", PERSONAL_NATION);
SetTownNation("Oxbay", PERSONAL_NATION);
SetTownNation("Greenford", PERSONAL_NATION);
SetRank(PChar, ENGLAND, 7);
SetRankTitle(PChar, TranslateString("", "Sir"));
DeleteAttribute(PChar, "boardingmodels");
PChar.boardingmodels = "Soldiers";
for (i = 1; i <= 5; i++)
{
NPChar = CharacterFromID("Crewmember_0" + i);
SetModelFromID(NPChar, GetRandomModelForType(true, "Soldiers"));
}
for (i = 1; i <= 10; i++)
{
NPChar = CharacterFromID("Treas_Crewmember_" + i);
SetModelFromID(NPChar, GetRandomModelForType(true, "Soldiers"));
}
LAi_group_SetRelation("ENGLAND_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_FRIEND);
LAi_group_SetAlarmReaction("ENGLAND_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_FRIEND, LAI_GROUP_FRIEND);

Here's another issue I'm having: although Redmond, Greenford, and Oxbay are set as my colonies, I don't get taxes from them until I select "Manage" and "OK". Only then do I start collecting gold. Similarly, I've set my character to "Knight" but I don't get any money from my estates...how should this be fixed?

Don't assign Gibbs as an officer. You meet him in Tortuga tavern and he gives you the Aztec compass. Any character can meet him there, but it's especially appropriate for Jack Sparrow. And don't assign Anamaria because you'll find her wandering around Tortuga and you'll get slapped if you talk to her. She's not a character you can remove, either; she's part of the code for various things going on in Tortuga.

Didn't Jack get his compass either from Tia Dalma or the captain of the Wicked Wench in the movies? I'm trying to make this Jack the Jack from the films, or at least make things feel a little bit like that's the case...

Jack met Gibbs in Tortuga after Barbossa's betrayal, which means he didn't have the Pearl at the time. But the Jack I'm editing has the Pearl, which means it's either before Barbossa's mutiny (meaning I should make Barbossa the first mate), or after COTBP (which means Gibbs has to be my first mate).

The levelling system obeys "questchar" for skills but seems to ignore it for perks. See what happens if you assign the perks in "StartStoryline.c", e.g.:
Code:
characters[GetCharacterIndex("EngBodyguard1")].perks.list.BasicDefence = true;

So this is what I tried in Start Storyline:

if (GetMySimpleOldName(PChar) == "Robert Christopher Silehard" && PChar.model == "huber_eng")
{
SetOfficersIndex(Pchar, 1, GetCharacterIndex("EngBodyguard1")); // NK was -1
LAi_SetOfficerType(characterFromID("EngBodyguard1"));
characters[GetCharacterIndex("EngBodyguard1")].Dialog.Filename = "Enc_Officer_dialog.c"; // KK
characters[GetCharacterIndex("EngBodyguard1")].Dialog.CurrentNode = "Hired"; // KK
SetOfficersIndex(Pchar, 2, GetCharacterIndex("EngBodyguard2")); // NK was -1
LAi_SetOfficerType(characterFromID("EngBodyguard2"));
characters[GetCharacterIndex("EngBodyguard2")].Dialog.Filename = "Enc_Officer_dialog.c"; // KK
characters[GetCharacterIndex("EngBodyguard2")].Dialog.CurrentNode = "Hired"; // KK
characters[GetCharacterIndex("EngBodyguard1")].perks.list.BasicDefence = true;
characters[GetCharacterIndex("EngBodyguard1")].perks.list.AdvancedDefence = true;
characters[GetCharacterIndex("EngBodyguard1")].perks.list.CriticalHit = true;
characters[GetCharacterIndex("EngBodyguard1")].Perks.list.Toughness = true;
}

That didn't seem to solve it...

Apparently this is what seems to happen: when an Officer is "activated" (that's to say you put him in one of those four boxes in "Passengers" thus making him follow you around), his skills and perks are "scrambled". Any triggers that assigned his perks beforehand are ignored, and the game then randomises them. This is whether or not said officer is "questchar".

The only way I've managed to make it work, is by putting "SetOfficersIndex" in Start Storyline, which makes them automatically "activate" in the very start. Then their perks are assigned in both_reaction.c - this means the perks I want for them are assigned AFTER this "randomisation".

This won't be possible if I want, for example, 8 officers and I want their perks to be pre-determined, because then only 3 of them will have these pre-determined perks...

Any way around this? This is all so strange.


They won't attack you if they're Personal. Britain probably doesn't like you if you've taken over three of its colonies, so if you make Norrington British, he'll probably attack you regardless of what ship you're using. If you fly a pirate flag they will probably also attack you, again regardless of which ship you're sailing. I don't know of any mechanism to make anyone hostile because you're using a particular ship.

I've no idea how to make someone chase you on the worldmap or open sea. Easier would be to have Norrington appear when you approach a particular island, though still tricky. You're going to need to learn how to write quests. And for that, you should first try playing a storyline or two, then look at their quest code to see how they work. The "Hornblower", "Assassin" and "Bartolomeu" storylines are easiest to follow.

It's not about Norrington "following me around the map", but a trigger that would make his ship appear next to me and attack me at certain dates. Such as in the Mergilio Hurtado quest where the Montanez appears right next to your ship.

What you seem to be suggesting to me at this point, is to change Jack's time frame from after the events of COTBP, to before Barbossa's mutiny because then I won't have to worry about setting Norrington to attack me or Anamaria...
 
Last edited:
I tried to do that, but what I don't like is that they wear Personal Soldier uniforms. They should be wearing British soldier uniforms - I'm supposed to be governor of a British colony, not a personal one.
You can't be governor of a British colony. The only way you can control a colony is to take it over for yourself, which means it's Personal. In any case, as far as the game is concerned, the governor of Port Royale is still "John Clifford Brin", a character who is given a different name and outfit depending on period but is still the same character. There are a couple of ways to change the governor. One is a function called 'SetTownGovernor', though as far as I can see from looking at the code, that simply turns the town's actual governor character into a clone of the "new governor", then removes the "new governor" character. Thus, 'SetTownGovernor("Redmond", CharacterFromID("Artois Voysey"))' would turn "John Clifford Brin" into a clone of Artois Voysey, then set Artois Voysey to location "None". So don't try using this to set yourself as governor!

Another way is to set the town's "gov" attribute directly to the character ID of your choice. I did that in "Ardent"; it's possible for you to fail to prevent an invasion of Port Royale, in which case the story's villain becomes governor. I've no idea what would happen if you set the town's "gov" attribute to your own ID, which is always "Blaze", but it would probably do nasty things to the game.

And so the game doesn't recognise you as governor, it still regards "John Clifford Brin" as the rightful governor of Port Royale.

Strangely enough, the port guards don't fight back when I attack them. But they're the only ones to respond this way in Redmond - every other soldier attacks me. The guys by the mansion attack me. By the church attack me. What's really weird to me is why they are so aggressive despite me setting for them the exact same code I did to the cave animists in the other Freeplay, which ended the way I wanted (that is, no one attacks me even if I hit them!).
No, what's weird is that the port guards aren't similarly aggressive. Soldier AI groups tend to be reset when you leave a location, so that if you've upset them, they don't keep trying to attack you next time you visit the town and for ever more. So you've set them to be friends, then you leave the area, they revert to their standard settings, and then they defend themselves. The question then becomes, why aren't the port guards doing the same? As for "Animist_soldiers", that's not a regular soldier group so it isn't reset the same way. Having said that, AI sometimes does odd things anyway. The best rule is, don't hit any soldier, including your own, unless you want to risk him getting annoyed and hitting you back!

Incidentally, does it actually make sense that a governor collects taxes from his own colony? Or do these taxes go straight to the King? I'm not familiar with this.
In reality, the governor's job is to rule the colony on behalf of his king. Depending on exactly how the king or country has defined the job, he might get to keep some taxes for running the colony, while the rest go back to the home country because that's the point of having a colony. If the governor starts pocketing the taxes for himself, that's embezzlement and he's in big trouble if anyone finds out! But being a governor is a position of major responsibility so he probably gets a nice big salary.

Didn't Jack get his compass either from Tia Dalma or the captain of the Wicked Wench in the movies? I'm trying to make this Jack the Jack from the films, or at least make things feel a little bit like that's the case...

Jack met Gibbs in Tortuga after Barbossa's betrayal, which means he didn't have the Pearl at the time. But the Jack I'm editing has the Pearl, which means it's either before Barbossa's mutiny (meaning I should make Barbossa the first mate), or after COTBP (which means Gibbs has to be my first mate).
In the storyline, at least, Jack does indeed get the compass from Tia Dalma. You never meet another captain of the Wicked Wench. Depending on what you do right at the start, either you get it from a governor as a reward and then Cutler Beckett lets you keep it, or Cutler Beckett gives it to you himself.

Don't make Barbossa first mate. In the storyline, Jack needs to go to some effort to find Barbossa, who initially isn't interested. Barbossa only wants to join you when you have the compass and most of a map, as he has the last part. And, of course, if you're going to make Barbossa a first mate, you're going to have to figure out how to make him steal the Black Pearl... (Alternatively, just play the storyline which already does all of this. ;))

Apparently this is what seems to happen: when an Officer is "activated" (that's to say you put him in one of those four boxes in "Passengers" thus making him follow you around), his skills and perks are "scrambled". Any triggers that assigned his perks beforehand are ignored, and the game then randomises them. This is whether or not said officer is "questchar".
That can't be right, otherwise officers would have their perks scrambled every time you swapped them around in the "Passengers" interface. I've had characters who start off as NPC passengers who can't be assigned as officers but can be assigned perks. Then later they become officers, I can assign them to one of the four squares, and they still have the perks I gave them while they were just passengers.

The only way I've managed to make it work, is by putting "SetOfficersIndex" in Start Storyline, which makes them automatically "activate" in the very start. Then their perks are assigned in both_reaction.c - this means the perks I want for them are assigned AFTER this "randomisation".

This won't be possible if I want, for example, 8 officers and I want their perks to be pre-determined, because then only 3 of them will have these pre-determined perks...

Any way around this? This is all so strange.
See what happens if you assign them as passengers and then set their perks. Instead of 'SetOfficersIndex', use 'AddPassenger(PChar, CharacterFromID(<insert_character_here>, 0)'. (If you put 1 instead of 0, the character is a prisoner.)

It's not about Norrington "following me around the map", but a trigger that would make his ship appear next to me and attack me at certain dates. Such as in the Mergilio Hurtado quest where the Montanez appears right next to your ship.
Mergildo Hurtado doesn't appear on a certain date. He appears when you arrive at Barbados. You can take as long as you like to get there. That can be arranged easily enough for Norrington as well. You already know how to make an enemy appear next to you - 'Group_SetPursuitGroup'.

What you seem to be suggesting to me at this point, is to change Jack's time frame from after the events of COTBP, to before Barbossa's mutiny because then I won't have to worry about setting Norrington to attack me or Anamaria...
What I'm suggesting is not to do much with Jack Sparrow at all. ;) FreePlay Jack Sparrow gets "UncursedPearl", which is the ship before it was cursed but after it had been burned by Cutler Beckett. So that would indeed be before Barbossa's mutiny. Norrington doesn't need to attack you, Anamaria can remain wandering around Tortuga, Gibbs can stay in the tavern, and you can try to figure out how Gibbs got the compass...
 
You can't be governor of a British colony. The only way you can control a colony is to take it over for yourself, which means it's Personal. In any case, as far as the game is concerned, the governor of Port Royale is still "John Clifford Brin", a character who is given a different name and outfit depending on period but is still the same character. There are a couple of ways to change the governor. One is a function called 'SetTownGovernor', though as far as I can see from looking at the code, that simply turns the town's actual governor character into a clone of the "new governor", then removes the "new governor" character. Thus, 'SetTownGovernor("Redmond", CharacterFromID("Artois Voysey"))' would turn "John Clifford Brin" into a clone of Artois Voysey, then set Artois Voysey to location "None". So don't try using this to set yourself as governor!

Another way is to set the town's "gov" attribute directly to the character ID of your choice. I did that in "Ardent"; it's possible for you to fail to prevent an invasion of Port Royale, in which case the story's villain becomes governor. I've no idea what would happen if you set the town's "gov" attribute to your own ID, which is always "Blaze", but it would probably do nasty things to the game.

And so the game doesn't recognise you as governor, it still regards "John Clifford Brin" as the rightful governor of Port Royale.

Alright, so what I did was I used CaptureColony/Town on the three colonies. Now they're under me, so the soldiers act as if they're my soldiers, and I gave all of them British soldier models so that they still look correct.

A few issues I still want to address for this governor Freeplay:

1 - Most importantly, I tried to put a code that would set Redmond, Oxbay, and Greenford to "ENGLAND" should I betray the British. As it is, they're set to PERSONAL_NATION, so even if I become hostile to England, these colonies are still under me and they won't fire on me when I go there. Instead of this happening, I want them to become hostile to me as well, and lose their PERSONAL_NATION status - Redmond should go to John Clifford Brin like in the standard storyline. And so here's what I placed in both_reaction.c:

if(GetRMRelation(PChar, ENGLAND) < REL_AMNESTY)
{
SetTownNation("Redmond", ENGLAND);
SetTownNation("Oxbay", ENGLAND);
SetTownNation("Greenford", ENGLAND);
CaptureTownForNation("REDMOND", ENGLAND);
CaptureColony("REDMOND", ENGLAND);
}

But nothing happens. After firing on the Cayman fort and my relation going from Knight to -60, the colonies still remain Personal and they don't become hostile to me. What's wrong here?

2 - Despite switching to AddPassenger on Start Storyline and setting the perks on both_reaction.c, when I activate them, they lose their perks. The perks are set when I view them before this, but they're basically erased when I set them to be my companions. o_O

3 - Although the three towns are captured and I'm set to Knight in both_reaction.c, I earn no taxes until I actually click "Manage" then "OK" on Colonies. Likewise, I get no money from my estates. What's lacking and what should I do here?

4 - A few other things:

- When in the Oxbay canyon, the group of bandits that are there attack only my two guards - they don't attack me. This is despite my portrait flashing red and the fight music going on - after they killed my two guards, the "fight mode" was still ongoing but they were just standing there.

- I had to set each and every soldier in my three towns to have an English soldier model. What code should I use to address a group of characters? Is there a way to automatically set all English citizens to have a certain model, for example? Finally, is there a way I could view a character's ID ingame? This is because the only soldiers left that I know who are still using Personal Soldier uniforms are the ones in the fort and the two guys in the Greenford and Redmond prisons, but I couldn't find their ID's.
 
1 - Most importantly, I tried to put a code that would set Redmond, Oxbay, and Greenford to "ENGLAND" should I betray the British. As it is, they're set to PERSONAL_NATION, so even if I become hostile to England, these colonies are still under me and they won't fire on me when I go there. Instead of this happening, I want them to become hostile to me as well, and lose their PERSONAL_NATION status - Redmond should go to John Clifford Brin like in the standard storyline. And so here's what I placed in both_reaction.c:

if(GetRMRelation(PChar, ENGLAND) < REL_AMNESTY)
{
SetTownNation("Redmond", ENGLAND);
SetTownNation("Oxbay", ENGLAND);
SetTownNation("Greenford", ENGLAND);
CaptureTownForNation("REDMOND", ENGLAND);
CaptureColony("REDMOND", ENGLAND);
}

But nothing happens. After firing on the Cayman fort and my relation going from Knight to -60, the colonies still remain Personal and they don't become hostile to me. What's wrong here?
That doesn't work because it checks England's relation to you at the time, finds that you're friendly, and does nothing. What you need is to set up a quest:
Code:
PChar.quest.betrayed_england.win_condition.l1 = "relation";
PChar.quest.betrayed_england.win_condition.l1.relation = "Hostile";
PChar.quest.betrayed_england.win_condition.l1.nation = "ENGLAND";
PChar.quest.betrayed_england.win_condition = "betrayed_england";
That will trigger quest case "betrayed_england" when you turn hostile to Britain. Elsewhere in "both_reaction.c", define case "betrayed_england":
Code:
case "betrayed_england":
        CaptureTownForNation("REDMOND", ENGLAND);
        CaptureTownForNation("Oxbay", ENGLAND);
        CaptureTownForNation("Greenford", ENGLAND);
        ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "Redmond_Residence", "goto", "goto8");
break;
You don't need 'SetTownNation' as well because it's included in 'CaptureTownForNation'. You also don't need 'CaptureColony' if Britain is taking the colony for itself because 'CaptureColony' is specifically for when you capture a town, either for yourself or for a nation. It does some extra things such as change your status with nations and adds a ship's log entry; then it calls 'CaptureTownForNation'.

2 - Despite switching to AddPassenger on Start Storyline and setting the perks on both_reaction.c, when I activate them, they lose their perks. The perks are set when I view them before this, but they're basically erased when I set them to be my companions. o_O
Then I've no idea. I can take the "Sabine Matton" sidequest, she's a passenger, I can assign her perks while I sail to San Juan and back to St. Pierre. Then I get her as an officer, assign her as an active party member, and she still has the perks I gave her. In the "Ardent" storyline a key character becomes a passenger, can be assigned perks, then is put ashore at San Juan. Later you can recruit this character, who still has all the perks assigned before San Juan. So changing a character from passenger to officer doesn't normally wipe perks.

3 - Although the three towns are captured and I'm set to Knight in both_reaction.c, I earn no taxes until I actually click "Manage" then "OK" on Colonies. Likewise, I get no money from my estates. What's lacking and what should I do here?
No idea. I don't know in detail how taxes and estates work normally, let alone how to make them work by giving yourself titles and colonies by code rather than by earning titles and capturing colonies the usual way.

4 - A few other things:

- When in the Oxbay canyon, the group of bandits that are there attack only my two guards - they don't attack me. This is despite my portrait flashing red and the fight music going on - after they killed my two guards, the "fight mode" was still ongoing but they were just standing there.
The AI is messed up somehow. Normally those bandits should be in group "LAI_GROUP_MONSTERS" and should always attack you.

- I had to set each and every soldier in my three towns to have an English soldier model. What code should I use to address a group of characters? Is there a way to automatically set all English citizens to have a certain model, for example? Finally, is there a way I could view a character's ID ingame? This is because the only soldiers left that I know who are still using Personal Soldier uniforms are the ones in the fort and the two guys in the Greenford and Redmond prisons, but I couldn't find their ID's.
I wish it were that simple! I had to do something similar in "Tales of a Sea Hawk" to put all soldiers back into British uniform when Silehard recaptures Bridgetown. Take a look at "PROGRAM\Storyline\standard\quests\quests_reaction.c", case "Story_VoyageToKhaelRoaBegan". I didn't change their uniforms, I put them all back into AI group "ENGLAND_SOLDIERS", then let 'CaptureTownForNation' take care of the uniforms. But I still had to do it for each and every soldier character in and near Bridgetown, including a couple of soldiers by the mines.

But soldiers in forts and prisons don't have fixed ID's. They're randomly generated when you go into the fort or prison. If they're still in Personal uniform then the game still thinks the town is Personal and is generating soldiers appropriate to that.
 
That doesn't work because it checks England's relation to you at the time, finds that you're friendly, and does nothing. What you need is to set up a quest:
Code:
PChar.quest.betrayed_england.win_condition.l1 = "relation";
PChar.quest.betrayed_england.win_condition.l1.relation = "Hostile";
PChar.quest.betrayed_england.win_condition.l1.nation = "ENGLAND";
PChar.quest.betrayed_england.win_condition = "betrayed_england";
That will trigger quest case "betrayed_england" when you turn hostile to Britain. Elsewhere in "both_reaction.c", define case "betrayed_england":
Code:
case "betrayed_england":
        CaptureTownForNation("REDMOND", ENGLAND);
        CaptureTownForNation("Oxbay", ENGLAND);
        CaptureTownForNation("Greenford", ENGLAND);
        ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "Redmond_Residence", "goto", "goto8");
break;
You don't need 'SetTownNation' as well because it's included in 'CaptureTownForNation'. You also don't need 'CaptureColony' if Britain is taking the colony for itself because 'CaptureColony' is specifically for when you capture a town, either for yourself or for a nation. It does some extra things such as change your status with nations and adds a ship's log entry; then it calls 'CaptureTownForNation'.

So this is what I placed in both_reaction.c:

PChar.quest.betrayed_england.win_condition.l1 = "relation";
PChar.quest.betrayed_england.win_condition.l1.relation = "Hostile";
PChar.quest.betrayed_england.win_condition.l1.nation = "ENGLAND";
PChar.quest.betrayed_england.win_condition = "betrayed_england";

case "betrayed_england":
CaptureTownForNation("REDMOND", ENGLAND);
CaptureTownForNation("Oxbay", ENGLAND);
CaptureTownForNation("Greenford", ENGLAND);
ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "Redmond_Residence", "goto", "goto8");
break;

However, after firing on the Cayman fort setting my relation to England to -60, it says: ERROR - Quest name betrayed_england NOT found in ANY function .
 

Attachments

  • both_reaction.c
    186.1 KB · Views: 56
  • compile.log
    3 KB · Views: 51
That's because you put quest case "betrayed_england" inside quest case "hubeng_Continue" - I'm surprised it didn't crash the game with a message in "error.log"! Quest case "betrayed_england" needs to be separate. Try this.
 

Attachments

  • both_reaction.c
    186 KB · Views: 55
That's because you put quest case "betrayed_england" inside quest case "hubeng_Continue" - I'm surprised it didn't crash the game with a message in "error.log"! Quest case "betrayed_england" needs to be separate. Try this.

So, I might be nearly done for this freeplay. I'm actually thinking of making similar freeplays for all the 8 governors in the original story. Anyways, just a bit more things I have to tackle:

1 - After turning traitor to England, Redmond, Greenford, and Oxbay rightfully fall back into their original owners. However, when I go to the Redmond townhall and talk to Brin, he has the "underling governor" dialogue where I am able to "manage my colony". This is despite these lines:

CaptureTownForNation("REDMOND", ENGLAND);
CaptureTownForNation("Oxbay", ENGLAND);
CaptureTownForNation("Greenford", ENGLAND);
ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "Redmond_Residence", "goto", "goto8");
Towns[GetTownIndex("Redmond")].gov = "John Clifford Brin";
characters[GetCharacterIndex("John Clifford Brin")].Dialog.Filename = "John Clifford Brin.c"; // KK

2 - So I'm assigned 2 guards at the start. But I want them to attack me if I betray England. They should appear next to me, tell me that they intend to arrest me, and then fight me. What's the code for this?
 

Attachments

  • both_reaction.c
    208.5 KB · Views: 68
So, I might be nearly done for this freeplay. I'm actually thinking of making similar freeplays for all the 8 governors in the original story. Anyways, just a bit more things I have to tackle:

1 - After turning traitor to England, Redmond, Greenford, and Oxbay rightfully fall back into their original owners. However, when I go to the Redmond townhall and talk to Brin, he has the "underling governor" dialogue where I am able to "manage my colony".
First, looking at "both_reaction.c", case "hubeng_Continue":
Code:
Towns[GetTownIndex("Redmond")].gov = "Robert Christopher Silehard";
That's not going to work. Character "Robert Christopher Silehard" doesn't exist except in "Tales of a Sea Hawk", so you've set Port Royale's governor to a non-existent character. This will probably do nasty things to the game. Your ID is always "Blaze" regardless of your character's name, and setting Port Royale's governor to "Blaze" could also do nasty things.

You've captured Port Royale, alias "Redmond", for PERSONAL_NATION before you change the governor to the non-existent "Robert Christopher Silehard". Among other things, 'CaptureTownForNation' changes the name, nation and appearance of the governor, it doesn't replace the governor. So when you capture Port Royale, it changes "John Clifford Brin" into a Personal governor - he gets a new name and outfit, his nation is set to PERSONAL_NATION, but he's still the same character.

In case "hubeng_traitor":
Code:
CaptureTownForNation("REDMOND", ENGLAND);
CaptureTownForNation("Oxbay", ENGLAND);
CaptureTownForNation("Greenford", ENGLAND);
ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "Redmond_Residence", "goto", "goto8");
Towns[GetTownIndex("Redmond")].gov = "John Clifford Brin";
Here, 'CaptureTownForNation("REDMOND", ENGLAND)' tries to do the same to the current governor, which is "Robert Christopher Silehard", finds that he doesn't exist, and skips that part. So when you put "John Clifford Brin" back into place, he's still Personal. And that's why he uses the "underling governor" dialog.

You could put the line 'Towns[GetTownIndex("Redmond")].gov = "John Clifford Brin"' before the 'CaptureTownForNation' lines, so that he'll be converted back to a British governor at the same time as Port Royale is converted into a British colony. Or, for preference, don't try replacing the governor at all, and definitely don't replace him with a non-existent character!

2 - So I'm assigned 2 guards at the start. But I want them to attack me if I betray England. They should appear next to me, tell me that they intend to arrest me, and then fight me. What's the code for this?
That probably won't work because the check for betrayal of England is that England has turned hostile because of your actions. That's probably going to happen while you're at sea attacking an English ship or fort.

Besides, having to fight a couple of guards isn't much of a problem. Try adding:
Code:
PChar.Ship.Crew.Morale = 0;
to case "hubeng_traitor". Your ship won't take kindly to you turning traitor!
 
First, looking at "both_reaction.c", case "hubeng_Continue":
Code:
Towns[GetTownIndex("Redmond")].gov = "Robert Christopher Silehard";
That's not going to work. Character "Robert Christopher Silehard" doesn't exist except in "Tales of a Sea Hawk", so you've set Port Royale's governor to a non-existent character. This will probably do nasty things to the game. Your ID is always "Blaze" regardless of your character's name, and setting Port Royale's governor to "Blaze" could also do nasty things.

You've captured Port Royale, alias "Redmond", for PERSONAL_NATION before you change the governor to the non-existent "Robert Christopher Silehard". Among other things, 'CaptureTownForNation' changes the name, nation and appearance of the governor, it doesn't replace the governor. So when you capture Port Royale, it changes "John Clifford Brin" into a Personal governor - he gets a new name and outfit, his nation is set to PERSONAL_NATION, but he's still the same character.

In case "hubeng_traitor":
Code:
CaptureTownForNation("REDMOND", ENGLAND);
CaptureTownForNation("Oxbay", ENGLAND);
CaptureTownForNation("Greenford", ENGLAND);
ChangeCharacterAddressGroup(CharacterFromID("John Clifford Brin"), "Redmond_Residence", "goto", "goto8");
Towns[GetTownIndex("Redmond")].gov = "John Clifford Brin";
Here, 'CaptureTownForNation("REDMOND", ENGLAND)' tries to do the same to the current governor, which is "Robert Christopher Silehard", finds that he doesn't exist, and skips that part. So when you put "John Clifford Brin" back into place, he's still Personal. And that's why he uses the "underling governor" dialog.

You could put the line 'Towns[GetTownIndex("Redmond")].gov = "John Clifford Brin"' before the 'CaptureTownForNation' lines, so that he'll be converted back to a British governor at the same time as Port Royale is converted into a British colony. Or, for preference, don't try replacing the governor at all, and definitely don't replace him with a non-existent character!


That probably won't work because the check for betrayal of England is that England has turned hostile because of your actions. That's probably going to happen while you're at sea attacking an English ship or fort.

Besides, having to fight a couple of guards isn't much of a problem. Try adding:
Code:
PChar.Ship.Crew.Morale = 0;
to case "hubeng_traitor". Your ship won't take kindly to you turning traitor!

The governor issue has been fixed now. Regarding the crew morale change, it goes to "Treacherous" for like one day, but it rises again afterwards by itself, such that a few days after I check again and it's back at "High"?

Also, perhaps you could advice me on two things I'm experimenting with - the soldiers' betrayal and trying to put the option to "sleep" in the residence. I've tried working and working on this but the dialogs won't work.

1: Soldiers attack (for this I simply copied Thug_dialog.c and tried to use that as base)

In both_reaction.c:
LAi_QuestDelay("hubguardtraitorprefight", 0.0);

Further below that:
case "hubguardtraitorprefight":
characters[GetCharacterIndex("hubguard1")].dialog.filename = "Test_dialog.c";
LAi_SetActorType(characterFromID("Hubguard1"));
LAi_group_MoveCharacter(characterFromID("Hubguard1"), "Vengefulguards");
LAi_group_MoveCharacter(characterFromID("Hubguard2"), "Vengefulguards");
LAi_ActorDialogNow(characterFromID("Hubguard1"), pchar, "", -1);
break;

case "hubguardtraitorfight":
RemovePassenger(Pchar, CharacterFromID("Hubguard1"));
RemovePassenger(Pchar, CharacterFromID("Hubguard2"));
LAi_group_FightGroups("Vengefulguards", LAI_GROUP_PLAYER, true);
break;

In Test_dialog.c:
switch(Dialog.CurrentNode)
{
// -----------------------------------Äèàëîã ïåðâûé - ïåðâàÿ âñòðå÷à
case "First time":

Dialog.defAni = "dialog_stay1";
Dialog.defCam = "1";
Dialog.defSnd = "dialogs\0\017";
Dialog.defLinkAni = "dialog_1";
Dialog.defLinkCam = "1";
Dialog.defLinkSnd = "dialogs\woman\024";
Dialog.ani = "dialog_stay2";
Dialog.cam = "1";
Dialog.snd = "voice\THDI\THDI001";

dialog.text = DLG_TEXT[0];
link.l1 = DLG_TEXT[1];
link.l1.go = "Exit";

break;

case "Exit":
AddDialogExitQuest("hubguardtraitorfight");
DialogExit();
NextDiag.CurrentNode = NextDiag.TempNode;

break;
}
}

This makes hubguard1 walk up to me and talk, but nothing shows up in dialog.

2 - Sleep:

In both_reaction.c:
case "hubsleep":
DoQuestReloadToLocation("Redmond_Townhall_Bedroom", "reload", "reload1", "restore_hp");
break;

FPHubmaidtest_dialog.c:

//#include "DIALOGS\Thug_dialog.h"
void ProcessDialogEvent()
{
ref NPChar;
aref Link, NextDiag;

DeleteAttribute(&Dialog,"Links");

makeref(NPChar,CharacterRef);
makearef(Link, Dialog.Links);
makearef(NextDiag, NPChar.Dialog);

ref PChar;
PChar = GetMainCharacter();


switch(Dialog.CurrentNode)
{
// -----------------------------------Äèàëîã ïåðâûé - ïåðâàÿ âñòðå÷à
case "First time":

Dialog.defAni = "dialog_stay1";
Dialog.defCam = "1";
Dialog.defSnd = "dialogs\0\017";
Dialog.defLinkAni = "dialog_1";
Dialog.defLinkCam = "1";
Dialog.defLinkSnd = "dialogs\woman\024";
Dialog.ani = "dialog_stay2";
Dialog.cam = "1";
Dialog.snd = "voice\THDI\THDI001";

dialog.text = DLG_TEXT[0];
link.l1 = DLG_TEXT[1];
link.l1.go = "Exit";
link.l2 = DLG_TEXT[2];
link.l2.go = "room";

break;

case "room":
string roomWait = "";
dialog.snd = "Voice\CHWI\CHWI012";
dialog.text = DLG_TEXT[3];
if (makeint(environment.time) >= 22.0 || makeint(environment.time) < 10.0)
{
roomWait = "eveningwait";
link.l1 = DLG_TEXT[4];
link.l1.go = "room_day_wait";
}
else
{
roomWait = "daywait";
link.l1 = DLG_TEXT[5];
link.l1.go = "room_night_wait";
}
link.l2 = XI_ConvertString("Until tomorrow") + " " + XI_ConvertString(roomWait) + ".";
link.l2.go = "room_24_wait";
break;

case "room_24_wait":
DialogExit();
Diag.CurrentNode = Diag.TempNode;
AddDialogExitQuest("hubsleep");
WaitDate("",0,0,0,24,1);
RecalculateJumpTable();
break;

case "room_night_wait":
DialogExit();
Diag.CurrentNode = Diag.TempNode;
AddDialogExitQuest("hubsleep");
TavernWaitDate2("wait_night");
break;

case "room_day_wait":
DialogExit();
Diag.CurrentNode = Diag.TempNode;
AddDialogExitQuest("hubsleep");
TavernWaitDate2("wait_day");
break;

case "Exit":

DialogExit();
NextDiag.CurrentNode = NextDiag.TempNode;

break;
}
}

FPHubmaidtest_dialog.h:

string DLG_TEXT[20] = {
"Good day, Sir.",
"...",
"I'd like to sleep. Set up the bed.",
"How long?",
"Until morning.",
"Until night.",

};

If I can somehow get these to work, I think I could proceed to try another freeplay.
 

Attachments

  • both_reaction.c
    209.4 KB · Views: 61
  • Test_dialog.c
    970 bytes · Views: 65
  • Test_dialog.h
    204 bytes · Views: 62
  • FPHubMaidtest_dialog.c
    2 KB · Views: 60
  • FPHubMaidtest_dialog.h
    145 bytes · Views: 60
The governor issue has been fixed now. Regarding the crew morale change, it goes to "Treacherous" for like one day, but it rises again afterwards by itself, such that a few days after I check again and it's back at "High"?

Also, perhaps you could advice me on two things I'm experimenting with - the soldiers' betrayal and trying to put the option to "sleep" in the residence. I've tried working and working on this but the dialogs won't work.

1: Soldiers attack (for this I simply copied Thug_dialog.c and tried to use that as base)

...

This makes hubguard1 walk up to me and talk, but nothing shows up in dialog.
When "hubguard1" walks up to you and fails to talk, quit the game and then post "compile.log" and "error.log".

2 - Sleep:

...

If I can somehow get these to work, I think I could proceed to try another freeplay.
What happens when you talk to the maid? Again, if it doesn't work, post "compile.log", and "error.log" if it exists.

In "both_reaction.c", case "hubeng_traitor":
Code:
            ChangeCharacterAddressGroup(CharacterFromID("Hubwife7to9"), "none", "", "");
            ChangeCharacterAddressGroup(CharacterFromID("Hubwife9to10"), "none", "", "");

            ChangeCharacterAddressGroup(CharacterFromID("Hubwife10to12"), "none", "", "");
            ChangeCharacterAddressGroup(CharacterFromID("Hubwife12to13"), "none", "", "");

            ChangeCharacterAddressGroup(CharacterFromID("Hubwife13to18"), "none", "", "");
            ChangeCharacterAddressGroup(CharacterFromID("Hubwife18to19"), "none", "", "");

            ChangeCharacterAddressGroup(CharacterFromID("Hubwife19to20"), "none", "", "");
            ChangeCharacterAddressGroup(CharacterFromID("Hubwife20to7"), "none", "", "");
How many wives does this guy have? xD
 
Back
Top