• 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 Skills and abilities: Incorrect disposal of abilities to officers commanding ships

HellSailor

Privateer
Storm Modder
Using Beta 4 WIP (15th september version)

In a battle, I captured an enemy ship, and I put a first mate as its captain. If I am not mistaken, when you assign an officer as a captain of one of your ships, he gets all perks to contribute to the ship. Unfortunately... that doesn't seem to be the case. I put him as captain, and while it showed that the character WAS a captain, his abilities didn't change. Here you have a screenshot of that officer put as a captain. As it shows, it appears to still have the abilities that can contribute only a first mate.

Problemas con capitán.jpg
 
Like I said it used to work but because of changed it doesn't work anymore.
Fixed it now already. Update is comming VERY soon (expect within 15 minutes).
 
@Levis: How about swapping this:
Code:
void MakeOfficerCaptain(ref officer)
{
   string officerType = OFFIC_TYPE_REGCAP;
   ref captain = GetCharacter(GetCaptainIndexCompanion(officer));
   if(ProfessionalNavyNation() != UNKNOWN_NATION)
   {
     officerType = OFFIC_TYPE_CAPNAVY;
   }
   if (GetLetterOfMarqueQuantity() > 0)
   {
     officerType = OFFIC_TYPE_CAPPRIVATEER;
   }
   if (CheckCharacterItem(captain, "EITC_Passport") || CheckCharacterItem(captain, "Trade_Passport"))
   {
     officerType = OFFIC_TYPE_CAPMERCHANT;
   }
   if (GetServedNation() == PIRATE)
   {
     officerType = OFFIC_TYPE_CAPPIRATE;
   }
   officer.quest.oldofficertype = officer.quest.officertype;
   officer.quest.officertype = officerType;
}
With this?
Code:
void MakeOfficerCaptain(ref officer)
{
   officer.quest.oldofficertype = officer.quest.officertype;
   officer.quest.officertype = GetPlayerType();
}
That uses a function I wrote earlier which seems to do pretty much what you have there.
It is slightly different because it checks the player for the "EITC/Merchant Passport" item.
But you can only get one anyway and if the player is a merchant, probably the companions should be too.

It can also potentially return "Navigator", which may not be wanted. But that only happens for Hornblower during his storyline.
Would that be a problem? If so, we can tweak that function so it knows if it is called for the player or not.
 
I tought about it but I decided to keep it seperate like this because it might be changed. Besides that I try to have no dependecy of the main character so it works for other characters too (working towards adding officers etc to other ships).
 
I tought about it but I decided to keep it seperate like this because it might be changed. Besides that I try to have no dependecy of the main character so it works for other characters too (working towards adding officers etc to other ships).
You'd never be able to have a merchant companion captain then because you can't give your single passport item away (and you shouldn't need to as that is quite pointless ;) ).
ProfessionalNavyNation, GetLetterOfMarqueQuantity and GetServedNation are also by definition player-dependent.
And I like keeping centralized functionality wherever we can.

However, we can easily change that function to something like this instead:
Code:
string GetCaptainType(ref chr)
{
   ref pchar = GetMainCharacter();
   string PlayerType = OFFIC_TYPE_REGCAP;
   if (CheckCharacterItem(pchar, "EITC_Passport"))     PlayerType = OFFIC_TYPE_CAPMERCHANT;
   if (CheckCharacterItem(pchar, "Trade_Passport"))   PlayerType = OFFIC_TYPE_CAPMERCHANT;
   if (IsMainCharacter(chr))
   {
     if (CheckAttribute(pchar, "isnotcaptain"))     PlayerType = OFFIC_TYPE_NAVIGATOR;
   }
   if (GetLetterOfMarqueQuantity() > 0)         PlayerType = OFFIC_TYPE_CAPPRIVATEER;
   if (HaveLetterOfMarque(ProfessionalNavyNation()))   PlayerType = OFFIC_TYPE_CAPNAVY;
   if (GetServedNation() == PIRATE)           PlayerType = OFFIC_TYPE_CAPPIRATE;
   return PlayerType;
}
That way at least the Navigator option is ironed out.
We could also modify the other behaviour so that the three functions I mentioned above also aren't used for NPCs.
Only query then is: What to use instead?
 
Here is that function rewritten to hopefully behave more sensibly for ALL captains in the game:
Code:
string GetCaptainType(ref chr)
{
   string CaptainType = OFFIC_TYPE_REGCAP;
   if (IsCompanion(chr))
   {
     ref pchar = GetMainCharacter();
     if (CheckCharacterItem(pchar, "EITC_Passport"))     CaptainType = OFFIC_TYPE_CAPMERCHANT;
     if (CheckCharacterItem(pchar, "Trade_Passport"))   CaptainType = OFFIC_TYPE_CAPMERCHANT;
     if (IsMainCharacter(chr))
     {
       if (CheckAttribute(chr, "isnotcaptain"))     CaptainType = OFFIC_TYPE_NAVIGATOR;
     }
     if (GetLetterOfMarqueQuantity() > 0)         CaptainType = OFFIC_TYPE_CAPPRIVATEER;
     if (HaveLetterOfMarque(ProfessionalNavyNation()))   CaptainType = OFFIC_TYPE_CAPNAVY;
     if (GetServedNation() == PIRATE)           CaptainType = OFFIC_TYPE_CAPPIRATE;
   }
   else
   {
     if (CheckAttribute(chr, "FantomType"))
     {
       switch(chr.FantomType)
       {
         case "trade":                 CaptainType = OFFIC_TYPE_CAPMERCHANT;   break;
         case "pirate":                 CaptainType = OFFIC_TYPE_CAPPIRATE;     break;
         case "war":
           if (sti(chr.nation) == PIRATE)       CaptainType = OFFIC_TYPE_CAPPRIVATEER; // PB: I think this never happens
           else                   CaptainType = OFFIC_TYPE_CAPNAVY;
         break;
       }
     }
   }
   return CaptainType;
}
Theoretically the game could support NPCs having LoMs, but that isn't used anywhere.
So I think the "Privateer" captain type goes mostly unused.
You DID actually make it a genuine active captain type now, right?
 
In my function it doesn't check for the inventory of the officer, but the one he or she is a companion too. so if you have a passport they will be a merchant captain also. So in most cases it will just check the mainchar. But I'd like it to be variable.

The capprivateer wont happen yet. but I hope to tweak the worldmap generation still so then I can make it happen.
 
If you change the pchar in your function to:
ref captain = GetCharacter(GetCaptainIndexCompanion(officer));

I'm fine with it.
 
If you change the pchar in your function to:
ref captain = GetCharacter(GetCaptainIndexCompanion(officer));

I'm fine with it.
Wouldn't that have the same effect? Any companion ships are only ever the companion of the player.
NPC ships would fall to the other side of the if and have their captain type based on fantom type instead.
 
For now maybe, but maybe later it is. and I don't like backtracking :p.
It doesn't add any load or something but it does make the function more powerfull so I don't see why not.

altough thinking about it some more .... it wont work for the mainchar then ... so nevermind for now ....
 
As I said, everything else in that section also relies on the player character.
And IsCompanion is only ever true for a character in the player fleet.

Regular fleets at sea should be able to have different Captain types within a group for the merchants with navy escorts.
So unless you want to set up extra fake players with their own fleets, I don't quite see the need.

There might need to be something extra in place to ensure any escort quest companion IS merchant type regardless of the player.
 
As I said, everything else in that section also relies on the player character.
And IsCompanion is only ever true for a character in the player fleet.

Regular fleets at sea should be able to have different Captain types within a group for the merchants with navy escorts.
So unless you want to set up extra fake players with their own fleets, I don't quite see the need.

There might need to be something extra in place to ensure any escort quest companion IS merchant type regardless of the player.
I believe the escort companion is already set up to be the TRADER offic type. it's a special one for him
 
I believe the escort companion is already set up to be the TRADER offic type. it's a special one for him
Of course the GetCaptainType function shouldn't get triggered for an escort quest captain.
But just in case it does in the future, it would be nice to have a condition in place to set him to trader type there to be sure as well.
 
Back
Top