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

COAS Mod ReleaseCOASLoyaltyMod.zip

steelrat

Landlubber
Storm Modder
File Name: COASLoyaltyMod.zip
File Submitter: steelrat
File Submitted: 08 Jun 2010
File Category: City of Abandoned Ships Mods

COAS Loyalty MOD

  1. fixes the annoying bug where your quest officers constantly lose loyalty, no matter what you do
  2. neutral officers (Regular Sailor reputation), for loyalty judgment will now follow the generally held feeling for the captain

From the readme:

Ver 1.0 of Loyalty Mod for AOP2 COAS, by steelrat 7 Jun 2010 (public domain).

History:
7-JUN-2010: ver 1.0; all new;

------------------------------
MOD overview:
1. fixes the annoying bug where your quest officers constantly lose loyalty, no matter what you do
2. neutral officers (Regular Sailor reputation), for loyalty judgment will now follow the generally held feeling for the captain

------------------------------
MOD details:
Some actions in COAS have effects on your officer's loyalty. These actions are considered good or bad.
For instance, releasing a prisoner in port is considered a good action, while turning the prisoner into a slave is considered bad.
Your fellow officers judge your actions and lose or gain loyalty points accordingly. Thus a bad officer (reputation Swindler and below)
will gain loyalty for you turning a prisoner into a slave and will lose loyalty if you release the prisoner.
For good officers (reputation Trusted Sailor and above) it is exactly the opposite.

With this Mod, your Regular Sailors (on board and companions) have no opinion themselves. For judgment they look now to the opinion makers.
If most of the other officers are for or against your last action, the Regular Sailors will take over loyalty adjustment accordingly.
If opinion is on par or you have only Regular Sailors in your crew, no loyalty adjustment for Regular Sailors is done. Other officers
still follow their inclination.

Prisoners, quest passengers and convoy captains are excluded from opinion making and loyalty adjustment.

------------------------------
MOD compatibility:
tested with stock game and JSCombined Mods v 1.9
I think it can easily be included in other Mods since it only alters parts of "officers.c" file
feel free to use and/or include it in your own Mods

------------------------------
MOD installation:

manually: copy "officers.c" from the Zip to folder ..\Playlogic\Age of Pirates 2\Program\scripts (backup original file first)

with Mod manager:
I suggest using JSGME for installing this.
Download JSGME from: http://www.users.on.net/~jscones/software/
Place it in main game folder, run it once and let it make a MODS folder.
Unzip COASLoyaltyMod to the new MODS folder with WinZip or Win RAR or whatever you use.
Start JSGME and enable COASLoyaltyMod.

------------------------------

Thanks to Pieter Boelen (moderator of Pirates Ahoy! site) for his design suggestion :)


Have fun :dance

Edit: Mod is compatible with CMV 3.1.5 :rolleyes: Thanks to Radrunner for testing this.

Click here to download this file
 
Nice mod steelrat, I was wondering if there was something wrong with the loyalty in CoAS, or if it was just the way I had been playing that caused my officers loyalty to nose dive. I could never find any consistency one way or the other. :shrug
 
Nice mod steelrat, I was wondering if there was something wrong with the loyalty in CoAS, or if it was just the way I had been playing that caused my officers loyalty to nose dive. I could never find any consistency one way or the other. :shrug

Thanks :)

It definitely wasn't your playing style. I've had the same problem and started digging. No matter if you were a good or bad guy, those buggers lost loyalty. The quest officers somehow seem to miss the attribute 'alignment' (good or bad). That caused the loyalty check to always drop the loyalty by 1 point for every action you did. Seems to be an oversight by the programmers.

Anyway, that's fixed now :b:
 
well done mate. A lot of work went into this one. If all works as it should, this will be making it into the next release of CMv3.2

Well Done!!!
 
well done mate. A lot of work went into this one. If all works as it should, this will be making it into the next release of CMv3.2

Well Done!!!

Thanks FireBat, that's an honour :) I was glad to help. Alas, I got a tough job at the moment and can't spare much time for COAS (sniff). I'd like to provide much more bugfixes and stuff. Hope I find some time soon. And I will definitely take a look at CMv3.2 :keith
 
Was this included in CMV 3.1.5? If not, is it compatible?

It's not included in 3.1.5. And I'm not sure if it is compatible. I need to take a look at that sometimes (I'm a bit on a tight run). Perhaps you can check that as well. Scan the files contained in CMV 3.1.5. Is there a officers.c file included? If so, it likely isn't compatible and would required manual insertion. If not, you could simply replace the original officers.c file in folder "..\Playlogic\Age of Pirates 2\Program\scripts" with the one contained in the linked file at the top of this thread.

I'm posting the changed code here in case you (or someone else) wants to fiddle with it:

Code:
// BOAL ïîëíîñòüþ ïåðåäåëàíî ïîä íóæíû ÂÌË

/// boal -->
void OfficersReaction(string alignment)
{
int iPassenger;
int i, cn;
int majorityResult = 0;
ref sld;

//Trace("LOYALTY_MOD: >>>======== begin =============");
majorityResult = DetermineMajorityReaction(alignment);
//Trace("LOYALTY_MOD: majorityResult: " + majorityResult);

for (int io = 0; io<GetPassengersQuantity(pchar); io++)
{   // ëþáîé ïàññàæèð ó êîãî åñòü ïðèñòðàñòèå ìîæåò ñâàëèòü åñëè íàøè äåëà åìó íå ïî äóøå
iPassenger = GetPassenger(pchar, io);
if (iPassenger != -1)
{
//Trace("LOYALTY_MOD: before image >>>");
//TraceCharacter(characters[iPassenger]);
if (CheckAttribute(characters[iPassenger], "loyality"))
{
if (isOfficerNeutral(&characters[iPassenger]))
{
characters[iPassenger].loyality = makeint(characters[iPassenger].loyality) + majorityResult;
}
else 
{
if (getOfficerAlignment(&characters[iPassenger]) == alignment)
{
characters[iPassenger].loyality = makeint(characters[iPassenger].loyality) + 1;
}
else
{
characters[iPassenger].loyality = makeint(characters[iPassenger].loyality) - 1;
}
}
}
//Trace("LOYALTY_MOD: after image <<<");
//TraceCharacter(&characters[iPassenger]);
}
}
for (i=1; i<COMPANION_MAX; i++)
{
cn = GetCompanionIndex(pchar, i);
if(cn!=-1)
{
sld = GetCharacter(cn);
//Trace("LOYALTY_MOD: before image >>>");
//TraceCharacter(sld);
if (CheckAttribute(sld, "loyality"))
{
if (isOfficerNeutral(&sld))
{
sld.loyality = makeint(sld.loyality) + majorityResult;
if (CheckAttribute(sld, "PGGAi")) PGG_ChangeRelation2MainCharacter(sld, majorityResult); //navy
}
else
{
if (getOfficerAlignment(&sld) == alignment)
{
sld.loyality = makeint(sld.loyality) + 1;
if (CheckAttribute(sld, "PGGAi")) PGG_ChangeRelation2MainCharacter(sld, 1); //navy
}
else
{
sld.loyality = makeint(sld.loyality) - 1;
// ñïåöèàëüíî íå äàëåþ ïðèâåäåíèå ê 0 è ìàõ. ïîòîìó ÷òîá áûë çàïàñ ìèíóñîâ äëÿ ïðîâåðîê
if (CheckAttribute(sld, "PGGAi")) PGG_ChangeRelation2MainCharacter(sld, -1); //navy
}
}
}
//Trace("LOYALTY_MOD: after image <<<");
//TraceCharacter(&sld);
}
}
//Trace("LOYALTY_MOD: <<<======== end =============");
}

/// STEELRAT [7 JUN 2010] -->
// return true in case officer is considered regular sailor
bool isOfficerNeutral(ref _officer) 
{
int rep = REPUTATION_NEUTRAL;  // 45 = neutral as default setting in case officer has no rep
if (CheckAttribute(_officer, "reputation")) rep = sti(_officer.reputation); // retrieve value if officer has rep
if (rep > 40 && rep < 51) return true;  
return false;
}

// simply returning officers alignment. In case attribute is missing, it is derived from offs reputation
string getOfficerAlignment(ref _officer)
{
if (CheckAttribute(_officer, "alignment")) return _officer.alignment;
int rep = REPUTATION_NEUTRAL;  // 45 = neutral as default setting in case officer has no rep
string _alignment = "";
if (CheckAttribute(_officer, "reputation")) rep = sti(_officer.reputation); // retrieve value if officer has rep
if (rep > 41) _alignment = "good";
else _alignment = "bad";
return _alignment;
}

// determine how majority of your officers react on your last action,
// excluding quest offs, regular sailors, prisoners, quest passengers, convoy captains 
// return 0 = officers opinion on par, -1 = majority against captain, +1 = majority for captain 
int DetermineMajorityReaction(string action) 
{
int iP, iC;
int _vote = 0;
ref companion;

//Trace("LOYALTY_MOD: action: " + action);

// loop over passenger list
for (int io = 0; io<GetPassengersQuantity(pchar); io++)
{
iP = GetPassenger(pchar, io);
if (iP != -1)
{
if (CheckAttribute(characters[iP], "loyality"))
{
if (!isOfficerNeutral(&characters[iP]))
{
if (getOfficerAlignment(&characters[iP]) == action) _vote++;
else _vote--;
}
}
}
}

// loop over companion list
for (int i=1; i<COMPANION_MAX; i++)
{
iC = GetCompanionIndex(pchar, i);
if(iC != -1)
{
companion = GetCharacter(iC);
if (CheckAttribute(companion, "loyality"))
{
if (!isOfficerNeutral(&companion)) 
{
if (getOfficerAlignment(&companion) == action) _vote++;
else _vote--;
}
}
}
}

//Trace("LOYALTY_MOD: value of vote: " + _vote);

// determine result: 0 = officers opinion on par, -1 = majority against captain, +1 = majority for captain
if (_vote < 0) return -1;
else if (_vote > 0) return 1;
return 0;
}

/*
void TraceCharacter(ref _char)
{
Trace("LOYALTY_MOD: id:" + _char.id + ", index: " + _char.index + ", name: " + _char.name + ", lastname: " + _char.lastname + ", reputation: " + _char.reputation + ", loyalty: " + _char.loyality + ", alignment: " + getOfficerAlignment(_char) + ", prisoner: " + _char.prisoned);
}
*/
/// STEELRAT [7 JUN 2010] <--

The code shown above replaces the top section of the original officers.c file up to but NOT including function "void OfficersReactionResult() "

Hence the code from OfficersReactionResult() function to bottom of file is the original program code.

I hope this helps.
 
If I recall, it IS compatible. If not, it's still easily merged with WinMerge.

FireBat might be able to correct me on this, but I think the only reason why it's not included in the CM 3.1.5 installer,
is because that only contains the content from previous patches that were made before this mod was released.
New content and fixes, including this mod, will be in the next patch. :yes

WinMerge is a program that I can recommend to anyone working with code, by the way.
It's INSANELY useful and I wouldn't know how I would've been able to do as much as I did over the past few years without it!
 
If I recall, it IS compatible. If not, it's still easily merged with WinMerge.

FireBat might be able to correct me on this, but I think the only reason why it's not included in the CM 3.1.5 installer,
is because that only contains the content from previous patches that were made before this mod was released.
New content and fixes, including this mod, will be in the next patch. :yes

WinMerge is a program that I can recommend to anyone working with code, by the way.
It's INSANELY useful and I wouldn't know how I would've been able to do as much as I did over the past few years without it!

Thanks for the hint Pieter. WinMerge, Notepad++ and so forth are a must for tweaking this game.

Off-topic: I hope the Dutch win the WC 2010 tonight :gday
 
Copied and pasted the officer.c file from the zip to appropriate folder.

Works like a charm, zero problems with CMV 3.1.5, loyalty is fixed for regular officers.

Two thumbs up!
 
Copied and pasted the officer.c file from the zip to appropriate folder.

Works like a charm, zero problems with CMV 3.1.5, loyalty is fixed for regular officers.

Two thumbs up!

Cool :dance Thank you for testing this. That's the spirit! That's what I like about this community. There are always helping hands, eyes and ears to be found here. Perhaps, bad ass Pirates aren't such bad folks after all ;)

Long live the Brotherhood of the Coast :cheers
 
Some say that pirates steal and should be feared and hated
I say we're victims of bad press it's all exaggerated
We'd never stab you in the back, we'd never lie or cheat
We're just about the nicest guys you'd ever want to meet

:wp
 
Some say that pirates steal and should be feared and hated
I say we're victims of bad press it's all exaggerated
We'd never stab you in the back, we'd never lie or cheat
We're just about the nicest guys you'd ever want to meet

:wp

...

Hey ho ho
It's one for all for one
And we'll share and share alike with you and love you like a son
We're gentlemen of fotune and that's what we're proud to be
And when your a professional pirate
You'll be honest brave and free
The soul of decency
You'll be loyal and fair and on the square
And most importantly
When you're a professional pirate
You're always in the best of company


... you got to finish the song ;)
 
I agree with FB, this is a must for the next patch for CMV. I belive its been made compatable with CMV 3.1.5, i will make sure its compatable with my work (not sure what fales have been changed in this mod yet) and look forward to seeing it in CMV 3.2. :dance

As for the song, well errrr. I have been doing to much of this :cheers at the local to even think stright. :wp
 
Hi @Everybody :)
I have the italian version of the Game with the CMV 3.1.5 and this Fix but the loyalty of Pitt and Ogle continues to drop down apparently for no reason
 
Hi @Everybody :)
I have the italian version of the Game with the CMV 3.1.5 and this Fix but the loyalty of Pitt and Ogle continues to drop down apparently for no reason

Hi Nspree,

and sorry for the late reply. I was on holiday. I will try to help you. I'm sure, that your Italian version should not be a problem. I'm guessing that the officers.c file should be the same for any language version of COAS.

Questions:

1. Did you install the Mod in the right place? Do you have other Mods installed? Perhaps the "officers.c" got overwritten by another Mod? Please check if your officers.c file is the one I provided in the MOD...

2. please list all your officers and companions in a reply to this post. I would like to know what their reputation is (Swindler, Shark, etc.) and if they are quest officers (like Ned Ogle and Jeremy Pitt).

3. tell me if you're playing as good or bad pirate and what you generally do when capturing enemy ships. Do you kill or enslave the captain and crew or are you the generous guy who sets them free? You most notably see a change in loyalty when you release a previously captured ship. Officers with good reputation will like it and gain loyalty, offs with bad rep will lose loyalty.

I hope we can solve the puzzle :dance
 
Back
Top