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

Fixed Incorrect Officer Types Assigned for Player and Quest Characters

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
Despite this, Hornblower is still labelled as "Navigator" all the way through.
Hmm.... I wonder if that is because of an officer type that is now set at game start and then never updated again.
Of course it isn't meant to be doing that. :facepalm
 
And apparently Bush is a captain. (Which he was for a while. I managed to board something and put him in command of it as he wasn't needed for quest purposes at the time.)

Meanwhile, if I start a new game, Midshipman Archie Kennedy is a citizen. Clayton is a surgeon. So is Sharpe - well, he is an expert at battlefield amputations. :D
 
For the player showing Navigator even after removing "isnotcaptain", can you force the player to LOOSE his navy status?
There are two things at play here:
- The REAL player "captain type", which actually affects the game
- The player "officer type" that is probably being set once at game start and then never updated afterwards

One of those two is shown at the top of the F2>Character Interface and the other is shown in the bottom-right corner.
I can't remember which of the two goes where, but you could check that in PROGRAM\INTERFACE\character.c .

And apparently Bush is a captain. (Which he was for a while. I managed to board something and put him in command of it as he wasn't needed for quest purposes at the time.)
Him changing to a captain type when you assign him to another ship is, of course, correct.
But I assume he was removed from his command at some point again? How exactly did he get removed as captain?
I recall seeing some of @Levis' code that should set him back to his original officer type; maybe that is failing or being bypassed somehow?

Meanwhile, if I start a new game, Midshipman Archie Kennedy is a citizen. Clayton is a surgeon. So is Sharpe - well, he is an expert at battlefield amputations. :D
There is some code that assigns random citizens to an officer type of some kind. Most of them become citizen but a few become doctor.
Sounds like that is being run on your quest characters, while of course that is not intended.
Simplest solution may be to give them an appropriate officer type in the character init files.
 
For the player showing Navigator even after removing "isnotcaptain", can you force the player to LOOSE his navy status?
There are two things at play here:
- The REAL player "captain type", which actually affects the game
- The player "officer type" that is probably being set once at game start and then never updated afterwards

One of those two is shown at the top of the F2>Character Interface and the other is shown in the bottom-right corner.
I can't remember which of the two goes where, but you could check that in PROGRAM\INTERFACE\character.c .
What's shown at the top of the character interface is the character's rank. That's why I arranged for Hornblower to be promoted to rank 3 when Pellew confirms his commission. Rank 2 is currently defined as "Acting Lieutenant" and after that point Hornblower isn't acting any more, so promoting him to rank 3 means he's now "Lieutenant".

Him changing to a captain type when you assign him to another ship is, of course, correct.
But I assume he was removed from his command at some point again? How exactly did he get removed as captain?
He was removed from his command when I sold the prize ship he'd been commanding. ;)

There is some code that assigns random citizens to an officer type of some kind. Most of them become citizen but a few become doctor.
Sounds like that is being run on your quest characters, while of course that is not intended.
Simplest solution may be to give them an appropriate officer type in the character init files.
How do I do that?
 
What's shown at the top of the character interface is the character's rank.
Indeed the character rank does override the "Captain Type" at the top for navy officers and privateers.
That is why I suggested that you force Hornblower to LOOSE that status; then the other display should return.
I wonder if that one DOES then show correctly.

Maybe the player officer type should be shown at the top and the captain type at the bottom; I assume that is currently not the case.
I suspect that this is a "display error" and the game does actually behave as if you are a proper captain at that point.

@Levis: Does the player officer type actually DO anything?

He was removed from his command when I sold the prize ship he'd been commanding. ;)
And he stayed captain type then? That's a definite bug!

How do I do that?
Add a line:
Code:
ch.quest.officertype = OFFIC_TYPE_QUARTERMASTER;
Available officer types can be found in PROGRAM\Officers.c .

Above is written from memory, so my spelling may be not entirely correct.
 
The player officertype doesn't do much, but it does need to be there. Else I need to add some exceptions for the player in the code which is kinda useless...
 
The player officertype doesn't do much, but it does need to be there.
"Not much" or "nothing at all"? The player captain type CAN, of course, change during the game if you get a LoM or lose it, for example.
At the moment that doesn't update the player officer type, which I think is what @Grey Roger noticed in the interface.

A simple way of addressing it is by changing the Character Interface so the bottom-right corner doesn't read the stored officer type for the player, only for all NPCs.
That would be OK if the player officer type doesn't do anything, but if it DOES do something, then it should probably be changed to match.

This is actually the reason why I had both the up-to-date "captain type" AND the stored "officer type" shown in the same interface.
Then at least we can see when there is a mismatch; otherwise it would have been invisible, but still incorrect. :facepalm
 
nothing at all. but it should be there.
So I'm fine with changing the interface to showing the calculated type.
I'm also fine with changing the stored officertype each time you open the interface or when it's changed. This way we could lateron add something which triggers when this officertype is changed if people need to (for example a tutorial thingy once you become a privateer etc).
 
"Not much" or "nothing at all"? The player captain type CAN, of course, change during the game if you get a LoM or lose it, for example.
At the moment that doesn't update the player officer type, which I think is what @Grey Roger noticed in the interface.
I haven't got as far as getting the LoM - that only happens very near the end. (It was at the end until I added my extension.) What's failing to change my status from "Navigator" to "Captain" and back is the "PChar.isnotcaptain" attribute. Regardless of whether that's true or false, I remain a "Navigator".

So the officer type needs to be there for the player character despite not doing anything. And I need to add a 'ch.quest.officertype' to every character definition in "Story.c" in an attempt to force them to appropriate officer types regardless of this calculation. :facepalm
 
I haven't got as far as getting the LoM - that only happens very near the end. (It was at the end until I added my extension.) What's failing to change my status from "Navigator" to "Captain" and back is the "PChar.isnotcaptain" attribute. Regardless of whether that's true or false, I remain a "Navigator".

So the officer type needs to be there for the player character despite not doing anything. And I need to add a 'ch.quest.officertype' to every character definition in "Story.c" in an attempt to force them to appropriate officer types regardless of this calculation. :facepalm

If and officertype is set it won't change it.
Else it will assign a random officertype depending on things.
If the character has the isofficer attribute it will get an usable officertype (like first mate etc).
If not it will see if it has the ismerchant to set it to a merchant type
or isguard to set it to a guard type.
Else it will check if its friendly or not. When its not friendly it will get an random enemy type (like arbordage or randchar) else it will get and random NPC type. these are the ones just walking trough the town.
 
I haven't got as far as getting the LoM - that only happens very near the end. (It was at the end until I added my extension.) What's failing to change my status from "Navigator" to "Captain" and back is the "PChar.isnotcaptain" attribute. Regardless of whether that's true or false, I remain a "Navigator".
This may help:
Code:
DeleteAttribute(pchar, "isnotcaptain");
The way it is coded, it doesn't actually check if the attribute is true or not;
I'm afraid I was lazy and checked only if the attribute is there at all.... :oops:

Other than that, it looks like for the player, the actual captain type IS shown in the bottom-right.
Which turned out to be a good thing because it definitely made your issue really quite obvious!
The above should probably fix it. :doff

BTW: I see three points where the "not captain status" is removed, but only one where it is restored.
Should it not be restored one time less than it is removed? Am I missing something?

If the character has the isofficer attribute it will get an usable officertype (like first mate etc).
So those Hornblower quest characters for whatever reason do NOT get the "isofficer" attribute so for them before they are initialized.
 
@Levis: For the Beta 4 public release, we may want to slightly reconsider this code:
Code:
  if (!CheckAttribute(GameInterface.strings,"OfficerType"))
   {
     // SUBTITLE: Officer type
     GameInterface.strings.OfficerType = XI_ConvertString(GetAttribute(xi_refCharacter, "quest.officertype"));

     // TITLE: Indicate character type/category
     if (IsMainCharacter(xi_refCharacter))
     {
       GameInterface.strings.fakeTitle  = XI_ConvertString(GetAttribute(xi_refCharacter, "quest.officertype"));
       GameInterface.strings.OfficerType = XI_ConvertString(GetCaptainType(xi_refCharacter)); // PB: Indicate Player Type as subtitle to ensure it ALWAYS displays
     }
Most notably, there is probably very little point in showing the player officer type that is stored at the beginning of the game, then never updated. :facepalm
 
This may help:
Code:
DeleteAttribute(pchar, "isnotcaptain");
The way it is coded, it doesn't actually check if the attribute is true or not;
I'm afraid I was lazy and checked only if the attribute is there at all.... :oops:
I was wondering if that might be the case. ;) But I was looking at other things and never got round to replacing 'PChar.isnotcaptain = false;' with 'DeleteAttribute(Pchar, "isnotcaptain");'.

BTW: I see three points where the "not captain status" is removed, but only one where it is restored.
Should it not be restored one time less than it is removed? Am I missing something?
The attribute is set true twice - once in "Storyline.c" and once at "Find_lodgings". It is set false twice - "A_new_Quest_Line" and "Set_up_the_quest1". And then it is deleted entirely at "assigned_to_atropos5". The logic is as follows: you start out as not a captain, become a captain when you receive Retribution, stop being a captain when you're decommissioned, become a captain again when you receive Hotspur, and are permanently a captain when you receive Atropos and switch to free-play.

Of course, if the two 'PChar.isnotcaptain = false;' lines are replaced by 'DeleteAttribute(pchar, "isnotcaptain");' then the final 'DeleteAttribute' won't be needed, leaving a total of two settings and two removals.
 
Of course, if the two 'PChar.isnotcaptain = false;' lines are replaced by 'DeleteAttribute(pchar, "isnotcaptain");' then the final 'DeleteAttribute' won't be needed, leaving a total of two settings and two removals.
I did that already in my own game version. So then indeed that last call may be deleted.

Actually, should there be anything else that currently happens when you are assigned as commander of the Atropos that should actually happen earlier when you get the Hotspur?
The "isnotcaptain" flag does have an impact on the game. If I recall, it enables salary payment and food/rum consumption for your crew.
That may have some impact on how the story plays out, so I wonder if there is a need to give the player some extra goods/money to deal with that before the end of the storyline.
But that is up to you. :doff
 
Hotspur should get some default supplies. You won't have her for long, unless you deviate from plot and go off hunting enemy ships, in which case money shouldn't be a problem. Otherwise it's a quick trip from Bridgetown to Guadeloupe and back, then you're into free-play mode with Atropos.

I'll leave it for now. If someone reports that they ran into trouble because they couldn't pay their salaries then I'll have the player get some extra money, along with a warning from Admiral Pellew that it's your payroll so don't go spending it!

However, the line handing you Atropos is 'GiveShip2Character(pchar, "HMS_Greyhound", "Atropos", -1, ENGLAND, true, false);'. That "false" means she won't get default supplies, so you may want to change it to "true".
 
However, the line handing you Atropos is 'GiveShip2Character(pchar, "HMS_Greyhound", "Atropos", -1, ENGLAND, true, false);'. That "false" means she won't get default supplies, so you may want to change it to "true".
Indeed, that can easily be done. Don't remember why I set it to false in the first place.
Now that I think of it, that might be because of the books; I recall Hornblower had some trouble getting crew and/or supplies for his new command.
 
@Grey Roger: Did you test the DeleteAttribute approach now? Does it work correctly with that?

And is assigning the "ch.quest.officertype" attributes in the character init entries a viable solution for you or is something else still needed?

I'm wondering if this one can be marked as "Fixed" already.
 
I haven't had time yet to go back and see what happens to Bush after the change to 'DeleteAttribute'. The most recent job has been sorting out redcoat Sharpe. Then I need to see about all those 'ch.quest.officertype' additions...
 
Bush is the officer who shows up as "Captain" when you're a captain and he's your lieutenant.
 
Back
Top