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

WIP Increasing Companion Limit

What does this do? I don’t know which to set those numbers to...
Code:
   for(i=1;i<4;i++)   {if( GetOfficersIndex(pCharacter,i)>=0 || GetCompanionIndex(pCharacter,i)>=0 ) break;}
   if(i==4)
   {
     bBeParty = true;
   }
   else
   {
     bBeParty = true;
   }
Where did you find that section?
At first impression, it makes no sense to me. o_O
 
This in LogInterface.c:
Code:
  for (i = 1; i < COMPANION_MAX; i++)
   {
     cn = GetOfficersIndex(mc,i);
     if(cn>=0)
     {
       chref = GetCharacter(cn);
       DeleteAttribute(chref,"MessageIcons");
     }
     cn = GetCompanionIndex(mc,i);
     if(cn>=0)
     {
       chref = GetCharacter(cn);
       DeleteAttribute(chref,"MessageIcons");
     }
   }
Should probably be split:
Code:
  for (i = 1; i < OFFICER_MAX; i++)
   {
     cn = GetOfficersIndex(mc,i);
     if(cn>=0)
     {
       chref = GetCharacter(cn);
       DeleteAttribute(chref,"MessageIcons");
     }
   }
   for (i = 1; i < COMPANION_MAX; i++)
   {
     cn = GetCompanionIndex(mc,i);
     if(cn>=0)
     {
       chref = GetCharacter(cn);
       DeleteAttribute(chref,"MessageIcons");
     }
   }

About this:
Code:
  for(i=1;i<4;i++)   {if( GetOfficersIndex(xi_refCharacter,i)>=0 || GetCompanionIndex(xi_refCharacter,i)>=0 ) break;}
   if(i==4) // MM - I'm unsure which these are supposed to be, COMPANION_MAX or OFFICER_MAX
   {
     bBeParty = true;
   }
   else
   {
     bBeParty = true;
   }
For one thing, that serves ZERO purpose because no matter what it does, 'bBeParty' is 'true'.
Looking at the use of the 'bBeParty' variable further down, I think it was meant to be TRUE for officers and companions, but FALSE for any other passengers.
A rewrite should have the first 'bBeParty' line set to 'false' and then it needs to be changed so it can handle different numbers for both MAX values.

As for:
Code:
curCharIdx = GetOfficersIndex(mchr, i - 3); // MM - OFFICER_MAX-1 ??
Yes, I do believe this would be correct:
Code:
curCharIdx = GetOfficersIndex(mchr, i - OFFICER_MAX-1);
This is actually some similar logic you would need to sort out those "cheat scrollers".

I hope that helps a bit. :doff
 
This in LogInterface.c:
Code:
  for (i = 1; i < OFFICER_MAX; i++)
   {
     cn = GetOfficersIndex(mc,i);
     if(cn>=0)
     {
       chref = GetCharacter(cn);
       DeleteAttribute(chref,"MessageIcons");
     }
   }
   for (i = 1; i < COMPANION_MAX; i++)
   {
     cn = GetCompanionIndex(mc,i);
     if(cn>=0)
     {
       chref = GetCharacter(cn);
       DeleteAttribute(chref,"MessageIcons");
     }
   }
Is companion and officer the wrong way around there? Shouldn’t it cycle the ships first?
 
Is companion and officer the wrong way around there? Shouldn’t it cycle the ships first?
Does the order matter? As far as I understand, that section is just meant to delete the attributes from all officers and companions.
As long as they're all gone by the end both sections are done, I doubt the order would make much of any difference.
Or am I misunderstanding it?
 
Well I dunno, maybe not. I suppose it doesn’t need to do that if it intends to looks at every character. However, if that’s the case then why would it only look at four of them? That it looks at four suggests it is cycling through each party on a per-case basis (whether that is the player and his officers, or a fellow ship). Mind you, it does this with salary, so I really ain’t got a clue. But... since the officers showed at the top in the first place, I don’t know why I used companion max, it looks very wrong now that I think about it. Probably a copy/paste error.
:shrug
 
Last edited:
Well I dunno, maybe not. I suppose it doesn’t need to do that if it intends to looks at every character. However, if that’s the case then why would it only look at four of them? That it looks at four suggests it is cycling through each party on a per-case basis (whether that is the player and his officers, or a fellow ship). Mind you, it does this with salary, so I really ain’t got a clue. But... since the officers showed at the top in the first place, I don’t know why I used companion max, it looks very wrong now that I think about it. Probably a copy/paste error.
:shrug
I don't know what "MessageIcons" is supposed to do, but it is probably something to do with stuff showing on the HUD.
That would be officers on land and companion ships at sea. So I assume it has something to do with that,

Any ideas with this?
I'm afraid I don't quite understand the problem.
I also have to admit that I am not much of an expert on interfaces; whenever I need to do anything with them, it is plenty figuring out.
 
Basically, I’ve organised the ship transfer screen to display blank ships. Technically it means I can swap a ship from a current companion slot into an empty one, it actually works to an extent in its own right but since, I assume, the code copies ship attributes at some point then this kinda goes wonky if one of those ships, well, doesn’t have any attributes because there simply is no ship. What happens here is that the real ship can be lost so this needs to be avoided, and it is for that reason I have prevented blank slots from being sent to the exchange screen for the time being.

Look at the images I posted, you can see the empty ship slots; I’m trying to swap a ship between them with that interface because it seems to be the most effective way of doing so. The actual problem is that once slot 5 has been opened, it cannot be closed without sinking the ship which sits in it because it cannot be sold at the shipyard, hence why I need to be able to move it into slot 2, 3 or 4.

Currently the interface file I uploaded is working really well, it allows ships in slot 5+ to be exchanged with and the system is quite happy to do it.

Ultimately, what I need to do is copy the ship attributes into the desired slot while deleting them for the other one. Otherwise I will probably lose the real ship and end up with a ghost ship in the other slot which so far as I can tell will end up being sunk by the “Hand of God” (probably because it has no captain).
 
Last edited:
This is because you are trying to switch the "companion numbers" around so you can get any one inside the "main four slots", I imagine?

I think those are generally stored in attributes on the player character, so effectively that is what you need to swap around.
But how to work that into an interface, I do not know.

Specifically why do you need your ships to get inside the main four slots though?
What actions do you want to perform on them that you currently can't?
 
This is because you are trying to switch the "companion numbers" around so you can get any one inside the "main four slots", I imagine?
Pretty much, yep.
Specifically why do you need your ships to get inside the main four slots though?
What actions do you want to perform on them that you currently can't?
Selling them.
The actual problem is that once slot 5 has been opened, it cannot be closed without sinking the ship which sits in it because it cannot be sold at the shipyard, hence why I need to be able to move it into slot 2, 3 or 4.
 
Last edited:
Selling them.
Ah, that's a tough one. I'm not at all sure how to do that and definitely not in a simple way.

How about a completely alternate solution?
It is quite possible to add "shared" dialog files that are used by every single shipyard. In fact, I think one already exists.
For all the ships outside your "normal four slots", you could add a dialog line that allows you to either sell or fully repair that ship.
Bit limited compared to the full shipyard interface, but more easily accomplished.

Might that be an option?
 
Well it would be an option I suppose, and a viable one at that. Then again, I’m determined! ;)

Okay, I think I realise what the problem is now. When the transfer screen is used to swap ships, the ships themselves switch over but the captains stay in the same slots. Therefore, when I do a swap with an empty slot the ship ends up with no captain, while the officer is captain of a ghost ship. If that makes sense. :unsure

Therefore, swapping the officers as well while forcibly deleting what will become an empty slot should suffice.
 
Well it would be an option I suppose, and a viable one at that. Then again, I’m determined! ;)

Okay, I think I realise what the problem is now. When the transfer screen is used to swap ships, the ships themselves switch over but the captains stay in the same slots. Therefore, when I do a swap with an empty slot the ship ends up with no captain, while the officer is captain of a ghost ship. If that makes sense. :unsure

Therefore, swapping the officers as well while forcibly deleting what will become an empty slot should suffice.
If you can make that work, then by all means! :onya
 
Maybe. First of all, I need to know how to take a companion index and check which slot it’s in. I’m pretty sure I’ve seen it a million times already. :rolleyes:
 
Maybe. First of all, I need to know how to take a companion index and check which slot it’s in. I’m pretty sure I’ve seen it a million times already. :rolleyes:
I think you want the GetCompanionNumber function.
 
Just noticed you have a line in kam_shiptransfer.c that used to be:
Code:
for (i=1; i<5; i++)
And is now:
Code:
for (i=1; i<=COMPANION_MAX; i++)
Isn't there a "+1" missing there?
 
Just noticed you have a line in kam_shiptransfer.c that used to be:
Code:
for (i=1; i<5; i++)
And is now:
Code:
for (i=1; i<=COMPANION_MAX; i++)
Isn't there a "+1" missing there?
Whoops! No, I don’t think it should be using that at all, should it? Isn’t that checking the berthing slots through 1-4?
 
Last edited:
Haha... yeah, nuke it. Unless berthing supports more than four ships then it needs to stay like it was before I mutilated it.

Otherwise it will cause it to skip the fourth ship if max companions is 4, I guess.

Having said that, if berthing does in the future support more, then yes it’ll be +1. ;)
 
Last edited:
Back
Top