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

Planned Feature Officer Loyalty

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
"Officer personalities" is something I have always been interested in seeing in this game.
Of course that can become complicated real quick and should probably be left on the back-burner until Build 15 or so.
However, there has actually been some sort of code for this in place ever since the STOCK GAME!

In various quest areas, there are calls to OfficersReaction("good") or OfficersReaction("bad") .
I always figured that was for a never finished feature and never bothered to look into it further.

Today I accidentally ran into the code for that actual function, which looks a fair bit more workable than I had expected!
Code:
void OfficersReaction(string alignment)
{
   int iPassenger;
   ref PChar;
   PChar = GetMainCharacter();

   for (int io = 0; io<GetPassengersQuantity(pchar); io++)
   {
     iPassenger = GetPassenger(pchar, io);
     if(CheckAttribute(characters[iPassenger], "loyality"))
     {
       if (characters[iPassenger].alignment == alignment)
       {
         characters[iPassenger].loyality = makeint(characters[iPassenger].loyality) + 1;
       }
       else
       {
         characters[iPassenger].loyality = makeint(characters[iPassenger].loyality) - 1;

         if(makeint(characters[iPassenger].loyality) < 1)
         {
           PlaceCharacter(&characters[iPassenger], "goto");
           characters[iPassenger].selfdialog.filename = characters[iPassenger].dialog.filename;
           characters[iPassenger].selfdialog.currentnode = characters[iPassenger].dialog.currentnode;
           characters[iPassenger].dialog.filename = "anacleto_dialog.c";
           characters[iPassenger].dialog.currentnode = "remove";
           LAi_SetActorType(&characters[iPassenger]);
           LAi_ActorDialog(&characters[iPassenger], pchar, "player_back", 2.0, 1.0);
           LAi_SetStayType(pchar);
         }
       }
     }
   }
}
In fact, I can see just about no reason why this should not already be working.
There is relevant code scattered all over the place to the point that they should leave you and you should be able to hire them again from their "home" location.

That being said, I don't think anybody ever ran into this behaviour actually being triggered.
So clearly something is preventing this from doing much of anything.
Based on a quick search, this might simply be because there are really very few spots where the OfficersReaction function is actually called.
Also, it applies only to specific quest-hired officers by the looks of it and not any random ones.

For starters, I'd be curious to hear from you guys if you ever DID notice this.
If not, we could see about forcing its hand by repeatedly calling the trigger function through the console.

In any case, I'm definitely intrigued now by the potential here.
Even if it is a fairly simplistic system to begin with, it is certainly more than nothing.
 
Anyone got any comments on this one?

For some reason I was thinking perhaps this might be a fun one for @pedrwyth to have a look at if he feels like it. :doff
 
I've seen the code also but for now I got my hands full on other stuff :p.
I could add a loyalty attribute to all officers very easy. So probably someone just has to figure out where to put the reactions and see what happens.
 
So probably someone just has to figure out where to put the reactions and see what happens.
My initial thought is to throw that together with my last ideas here: http://www.piratesahoy.net/threads/balancing-and-repurposing-reputation-gain.23862/
So tie it in with the larger reputation changes rather than having a separate function for it.
Alignment can also be set automatically for characters based on their initial reputation.
Then it could be made to apply to ALL characters and actually become a part of the game.
Provide the concept actually does work, which I don't know because I don't think anybody ever noticed it. :facepalm
 
For some reason I was thinking perhaps this might be a fun one for @pedrwyth to have a look at if he feels like it. :doff

Been away all this week and will be away all next week, however I haven't seen anything much else in the current bug list that doesn't fall into either fields that @Pieter Boelen or @Levis are/have been working on or else that I can't find how to trigger - so stock game non active code does look like something I might be lucky enough to stumble into some ideas to contribute. I'll try a search on the "good -bad" function calls and see where that leads this weekend before I go away again.

That said I have now got a copy of COAS and am bending my POTC thoughts to the Central American isthmus, its exploration possibilities as hinted at when the map was redrawn by @Armada (and - as a Scot - settlement such as Darien - recompense for the losses of which was pivotal in the decision to join with England- [hold those changes on the dates of Britain being pre-1700??]) with a view to build 15 possibilities - so perhaps my "feature request" would be a bit different..

Still a bird in the hand....
 
I'd definitely like exploration stuff on the Spanish Main too.
Probably would be a lot harder to set up, especially with the 3D modeling required for the shore lines as @Armada can attest.
But it would definitely be a cool feature. Probably something @Bartolomeu o Portugues would appreciate too.
So whatever you feel is worth doing. :cheers
 
Some time back when I first got drawn into tinkering I posted this as part of my thoughts on the Animists quest

In another thread @Pieter Boelen referred to the unfinished aspects of the original game.
A case in point is Jaoquin de Masse. The poor guy comes all the way from Italy (or Europe at least) to clear up the Animists and takes no further part in the affair unless you choose to include him.
In my case I already had much better companions so left him kicking his heels on the ship........

........It doesn't make sense for a man of his presumed beliefs/character to stay onboard after the quest completion with the majority of types of behaviour with which our character is likely to be engaged........

......One could also have him suggest he would be available in future in appropriate circumstances and where he might be found if needed.
Now it seems there was a similar thought active in the stock game!! He has a good alignment and would walk away if you were consistently"bad". So yes I will pursue this further.

The code does look like it is active but is probably just at too high a start loyalty to see an impact. The minimum quest character start loyalty level I have seen is seven (some as much as 15) and each good/bad call can change it by one - so it would require 7 actions all in the same direction to see an instance triggered. There are some cases where a 5 point drop is to be triggered but in the ones I have seen I don't think the code is currently going to work. Of course it is only on stock game scenarios that any "value" judgements have been inserted and again I don't think there are enough to trigger a walk away. However there is plenty of potential to add other instances where your officers/passengers can approve/disapprove of your actions in the added quests and indeed in general play.



I'll do some actual testing after I get back next weekend.
 
Some time back when I first got drawn into tinkering I posted this as part of my thoughts on the Animists quest

Now it seems there was a similar thought active in the stock game!! He has a good alignment and would walk away if you were consistently"bad". So yes I will pursue this further.
Ah, yes! That does fit in very nicely with that comment of yours.
And it would certainly make sense for him to not take kindly to evil acts.
I definitely like the idea that your officers care about what you do so that your acts actually have consequences of some kind. :woot

The code does look like it is active but is probably just at too high a start loyalty to see an impact. The minimum quest character start loyalty level I have seen is seven (some as much as 15) and each good/bad call can change it by one - so it would require 7 actions all in the same direction to see an instance triggered. There are some cases where a 5 point drop is to be triggered but in the ones I have seen I don't think the code is currently going to work. Of course it is only on stock game scenarios that any "value" judgements have been inserted and again I don't think there are enough to trigger a walk away.
I definitely think that is the reason why nobody ever noticed this behaviour from the actual game.
If you do a search in the PROGRAM folder for "OfficersReaction", you'll only find very few results.
So even if this WOULD work correctly, you'd really have to try hard to trigger it at all so nobody would ever know.
That is why I think the first step should be to manually trigger it through console and see what happens.
Then at least we'll know the current status.

However there is plenty of potential to add other instances where your officers/passengers can approve/disapprove of your actions in the added quests and indeed in general play.
Absolutely! I am thinking that rather than having this triggered through separate lines in the quest/dialog files, it could be linked with the normal reputation system.
That part IS being updated in many different spots and should be very close in spirit to this.
In fact, I figure that any "bad officer reaction" should be accompanied with a reputation loss and the other way around.

This could work well with @Grey Roger's and my idea for changes to the reputation system as described here:
http://piratesahoy.net/threads/balancing-and-repurposing-reputation-gain.23862/page-5#post-512372
As that would include a difference between small and larger acts of bad/good, the officer reactions could be set up so that they only occur for the larger changes.

I'll do some actual testing after I get back next weekend.
Thank you very much in advance! I'll mark this as "Planned Feature" now then. :cheers
 
For starters you might try to just execute the bad reaction trough the console and see what happens.
 
For starters you might try to just execute the bad reaction trough the console and see what happens.
Agreed; that would probably be the simplest way to see what already works now and what doesn't. :yes
 
Right - dropped back to build 14 3.4 because I had a save with Rys Bloom, Artois Voysey and Joaquin de Masse as passengers (its all stock game stuff anyway so why not). I also have Peter Blood for "bad" alignment when the time comes.

Made all three shore party and fast travelled to the store. Repeated console with OfficersReaction ("bad") did see them decide they had had enough of my bloodthirsty ways and me telling them to get lost- not all at once but then they probably had different starting loyalty levels from earlier behaviour in the save game. However none of them seemed able to work out how to leave the store and just milled aimlessly about. - So I left the store and they joined me outside (still appearing as shore party). Another bad reaction saw them resign (again) and this time they left (Rys even disappeared from the shore party icons - I think he might have in the store too -but the other two didn't). Another bad reaction saw them returning to me to resign again.

Next I took them off the shore party and left them as officers and jumped through the port gates to get the change initialised. Another bad console saw them return but it started to be a bit random as I walked about a bit which one would approach me to resign - the others then generally not bothering (perhaps they thought it should be clear by now!!). Rys definitely used the town gate reload and disappeared on the times he spoke to me. For those that remained they refused to have any dialogue with me.

Finally I tried removing them as officers and just left them as "comrade-in-arms" eg passenger. I moved to the dock.
Now it was always Rys that got to me first and the other two never followed him up. Co-incidentally a fight broke out and Artois was killed - and whilst his dead body remained he did not deem it necessary to turn up and resign for further "bad" console behaviour (of course he had now gone from the passenger list so was (EDIT -NOT) being tested in the "bad" calls anyway).

So a good start, what is missing is the follow up code calls required to remove a disgruntled passenger,officer or shore party. Code that obviously already functions in other circumstances. That done as the next step it will then be worth checking out the functionality of placing them at their home location and if they have the right dialogue.

EDIT - here's the relevant compile log where the calls being made are logged
 

Attachments

  • compile.log
    21.3 KB · Views: 103
Last edited:
I think the problem is here in PROGRAM\QUESTS\quests_common.c:
Code:
    case "removing_officer_comleted":
       iOfficer = sti(pchar.removed_officer);
       switch (characters[iOfficer].homestate)
       {
         case "sit": LAi_SetSitType(&characters[iOfficer]); break;
         case "citizen": LAi_SetCitizenType(&characters[iOfficer]); break;
       }
       characters[iOfficer].dialog.currentnode = "hired_again";
     break;
For reference, this is the code that is executed when you fire a tavern-hired officer yourself:
Code:
    case "LandEnc_OfficerFired":
       NPChar = GetCharacter(sti(Pchar.quest.FiringOfficerIDX));
       RemovePassenger(Pchar, NPChar);
       LAi_SetCitizenType(NPChar);
       NPChar.Dialog.CurrentNode = "Fired";
       NPChar.location = "none";

       DeleteAttribute(Pchar, "quest.FiringOfficerIDX");
       BLI_UpdateOfficers();
     break;

Here's a proposal to fix it:

In PROGRAM\DIALOGS\anacleto_dialog.c, outcomment the following lines:
Code:
    case "remove":
       if (npchar.alignment == "good")
       {
         dialog.snd = "Voice\ANAC\ANAC009";
         dialog.text = DLG_TEXT[18];
         link.l1 = DLG_TEXT[19];
       }
       else
       {
         dialog.snd = "Voice\ANAC\ANAC010";
         dialog.text = DLG_TEXT[20];
         link.l1 = DLG_TEXT[21];
       }
       link.l1.go = "exit";
       pchar.removed_officer = GetCharacterIndex(npchar.id);
       AddDialogExitQuest("removed_officer_runaway");
/*       npchar.location = npchar.homelocation;
       npchar.location.group = npchar.homelocation.group;
       npchar.location.locator = npchar.homelocation.locator;*/
     break;
It seems weird to set him to his next location while he has yet to actually leave your current location.

Then in PROGRAM\QUESTS\quests_common.c:
Code:
    case "removed_officer_runaway":
       GetCharacterPos(PChar, &locx, &locy, &locz);
       NPChar = GetCharacter(sti(Pchar.removed_officer)); // PB: Use this instead of character index as it is more direct
       LAi_ActorRunToLocation(NPChar, "reload", LAi_FindNearestFreeLocator("reload", locx, locy, locz), NPChar.homelocation, NPChar.homelocation.group, NPChar.homelocation.locator, "removing_officer_comleted", 10.0);
     break;

     // PB: Rewritten to match with "LandEnc_OfficerFired" -->
    case "removing_officer_comleted":
       NPChar = GetCharacter(sti(Pchar.removed_officer));
       RemovePassenger(Pchar, NPChar);
       switch (NPChar.homestate)
       {
         case "sit":  LAi_SetSitType  (NPChar); break;
         case "citizen": LAi_SetCitizenType(NPChar); break;
       }
       NPChar.Dialog.CurrentNode = "hired_again";
       NPChar.location = NPChar.homelocation;
       NPChar.location.group = NPChar.homelocation.group;
       NPChar.location.locator = NPChar.homelocation.locator;

       DeleteAttribute(Pchar, "removed_officer");
       BLI_UpdateOfficers();
     break;
     // PB: Rewritten to match with "LandEnc_OfficerFired" <--

Even nicer would be to have random officers and quest officers treated the same way here and have the same resigning/firing/rehiring apply to all of them.
But one thing at a time, right? :wp
 
After the beta4 release i will look for that.

I do think we nerd to change. It a bit. The homelocators won't work for random officers. But we could think of something. Like if there is no home locator they just stay at the local location.
 
I do think we nerd to change. It a bit. The homelocators won't work for random officers. But we could think of something. Like if there is no home locator they just stay at the local location.
If I recall, I saw some code to even keep random officers in their current location.
But I don't think that will be necessary. There is an infinite supply of them, so they can just wander off, never to be seen again.
It IS nice to maintain the ability to rehire your quest officers.
Not sure if that makes sense though; if this code was triggered, then they did not leave on good terms, so why would they want to rejoin you?
 
If I recall, I saw some code to even keep random officers in their current location.
But I don't think that will be necessary. There is an infinite supply of them, so they can just wander off, never to be seen again.
It IS nice to maintain the ability to rehire your quest officers.
Not sure if that makes sense though; if this code was triggered, then they did not leave on good terms, so why would they want to rejoin you?

I need to look into it more but if your rep goes up again they might rejoin.
If you made an random officer exactly as you want it might be nice to be able to rehire him. Especially if you unlocked his mind.
 
The homelocators won't work for random officers. But we could think of something. Like if there is no home locator they just stay at the local location.
Actually Rys Bloom has no homelocator information as it stands so he just disappears - I suspect because in the stock game he has no formal role in other quests (as far as I know) so is not essential. For random officers I would have thought that "home" elements could be generated based on where you are when you hire the random officer - so they return to their old haunts - but probably outside the tavern to avoid conflict with new spawned candidates? - however some locations already have too many character problems I believe- so it would need careful consideration I guess. I can see streets packed with former officers if the player takes the view they are not going to hire anyone who disagrees with their methods.

It IS nice to maintain the ability to rehire your quest officers.
Not sure if that makes sense though; if this code was triggered, then they did not leave on good terms, so why would they want to rejoin you?
I guess they want to give you a second chance, you have searched them out and asked them to sail with you - they only have 1 point of loyalty when re-hired so you have to watch your step and do things they like. You might actually need to recover a quest officer if you haven't finished the quest of which they are a part. At the moment you could constantly re-hire someone which definitely makes no sense so perhaps a one-time limit should be enforced.

My above suggested changes have now been included in here: Mod Release - Build 14 Beta 4 Internal WIP For Testing | PiratesAhoy!
Hopefully that will help @pedrwyth on his way. :doff
I had already tried them in 3.4 and it does allow Artois Voysey to walkaway and you to re-hire him at his "home" at the Nevis pirate settlement. At the moment the intended code to restore his dialogue file and previous current dialogue node does not work - so a bit to do there. The other snag I need to tackle is that multiple resignations don't work properly (well at all currently - I suspect you can only have one Pchar.removed_officer) - something which could be more common if all officers/passengers are to be in the system.
 
Pchar.removedofficer would be overwritten by the second officer to resign.
Maybe set a limit to only one officer resigning at the same time?
I imagine it should work if they wait in line for their chance to leave, right?
 
This is unfortunate. Previously, officers' reputations changed gradually along with yours, so that you can gradually bring an officer around to your alignment. It's a shame to lose that.

Also, it means that when you hire an officer, you need to check not only his abilities but also that his alignment matches yours, which is going to make the function of hiring a specific officer at a tavern less useful - you go to hire a gunner, the one who shows up is the wrong alignment, and you can't try again until you leave the island and return some other time. (This aspect doesn't bother me since I tend to go for the random officer at the table. If he's unsuitable then I leave, return, and see if the next one is any better. But those who prefer to hire a specific officer are in for a nasty surprise...)
 
This is unfortunate. Previously, officers' reputations changed gradually along with yours, so that you can gradually bring an officer around to your alignment. It's a shame to lose that.
Nobody said anything about losing that. But right now, your officers' reputation has absolutely zero influence on the game (except when you assign them as companion captain).
That doesn't seem right to me as their reputation SHOULD matter. If it doesn't, there is no point in having it at all and that is just a waste of gameplay potential.

Also, it means that when you hire an officer, you need to check not only his abilities but also that his alignment matches yours, which is going to make the function of hiring a specific officer at a tavern less useful - you go to hire a gunner, the one who shows up is the wrong alignment, and you can't try again until you leave the island and return some other time.
Actually, alignment isn't actually shown anywhere and my personal preference would be to keep it that way.
Some characters may be inherently evil, some good and maybe even some who don't particularly care either way.
That is all part of their personality which is something you wouldn't know when you first hire them.
This is something that should become apparent during play afterwards.

I'm not sure how this would work together with the "their reputation slowly changes to match yours" functionality.
It would be nice if they only change like that IF they do agree with what you're doing.
So a good character will join in your positive reputation changes, a bad with your negative changes and a neutral character will change with either.
That means you can see a problem forming if you have officers who reputation remains the same because apparently they do not quite see eye-to-eye with their captain.

In any case, there is technically nothing new here as for now the focus is on stock game functionality that applies to specific quest characters only.
Because the chance of this being triggered was extremely low, nobody ever noticed it (not) working up till now.
The first step will be fixing it so that it DOES work; then linking the changes in officer reaction to your changes in reputation so that this DOES become important for suh quest officers.
Then we'll have to see how to treat random officers. Eventually I would like to see them follow the same/a similar system too, but we'll have to think it through properly.
But we're not there yet. :wp
 
Back
Top