• 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

Updated file. I have now enabled ships to be swapped into empty slots.

This will allow people to sell excess ships by simply moving them about and putting whichever they need to sell into one of the first four slots so that they will show up in the shipyard, then they can easily be moved back again if needed. Bear in mind that if the player had only two ships with the companion ship being in slot 5 or higher, then it wouldn’t have been possible to sell it unless they acquired another one to swap it with, now it can be done.

Actually, something is forcing the ship to be moved to the first available slot - so if you select the final slot, it will always end up in first empty one. I’ll see if I can figure out what causes this, although it’s not really a big deal because it still works as intended.
 

Attachments

  • kam_shiptransfer.c
    17.3 KB · Views: 168
Last edited:
Ooooh, I did notice that (I don’t think I’d fit in if I hadn’t)! Thankin’ ye, cap’n!

:ship
“Hi-ho, hi-ho... off to plund’r we go,
With a bottle o’ rum an’ a piece o’ eight,
Off to plund’r we go!”
 
Last edited:
I think, but I’m not entirely sure, that there could be problems with repairs if there are a fair number of companions. If the companion limit is increased then I recommend only allowing the first four ships to benefit from auto-repairing, otherwise people might encounter severe FPS issues, and potentially a crash, when the daily updates kick in. Other features could be relevant as well, it’s certainly worth keeping in mind.

Anyway, whatever... I’ve plonked a couple of buttons on the ship interface to switch the companion offset so that the next four ships will be displayed. I’ll do the same for the shipyard interface as well but that’s for later, I’m tired. I think this would suit a maximum of 8 ships.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    183.7 KB · Views: 158
Last edited:
Here are the preliminary files. Gotta test it a bit more, but I think it’s all good. Should be easily portable to the shipyard as well.
 

Attachments

  • Files.zip
    15.2 KB · Views: 159
Here are the preliminary files. Gotta test it a bit more, but I think it’s all good. Should be easily portable to the shipyard as well.
If it isn't the case already, might it be possible to have those arrows show only if you actually have more than 4 ships in the fleet? Or if the game is set to allow more than 4?
Just to avoid potentially confusing players. :cheeky
 
Yeah, for sure. Checking the number of companions won’t work because a fourth ship could be sitting in the fifth slot, but I could certainly run a check through all the slots and return the last occupied one. They’re also reloading the interface at the moment and that’s probably completely avoidable. It’s a bit crude at the moment, gotta be worked on.
 
Yeah, for sure. Checking the number of companions won’t work because a fourth ship could be sitting in the fifth slot, but I could certainly run a check through all the slots and return the last occupied one.
Also perfectly fine, of course. :doff
 
Alright, I’ve got a switch on that now so they don’t show up unless the companion limit is more than four.

I still need to work on the shipyard file, but that looks like a lot more work since there is more going on.

Attachment updated above.
 
Got a bunch of stuff here for some loving from WinMerge for COMPANION_MAX. ;)

I think items.c has my random edits for the auto-equip toggle, but everything else should be unmodified.

I must warn you now... there are A LOT of quest and dialog files which do stupid things like this...
Code:
if (GetCompanionIndex(pchar,1) != -1 && GetCompanionIndex(pchar,2) != -1 && GetCompanionIndex(pchar,3) != -1)
Don’t even bother looking at Random_captains_sit_tavern_dialog.c lines #370 through to #436.
Why they aren’t in a simple loop is beyond me. I haven’t touched those. :sick
 

Attachments

  • Files.zip
    87.7 KB · Views: 150
Last edited:
I must warn you now... there are A LOT of quest and dialog files which do stupid things like this...
Code:
if (GetCompanionIndex(pchar,1) != -1 && GetCompanionIndex(pchar,2) != -1 && GetCompanionIndex(pchar,3) != -1)
That used to be OK of course, but isn't anymore.
That should probably be made into a "CheckIfFreeCompanionSlot" function instead.
Then it can be sorted with a "simple" search and replace.
 
What, like this?
Code:
 if (GetCompanionQuantity(pchar) == COMPANION_MAX)
 
Last edited:
I’ve already replaced them. :yes

Examples like below is easy enough, but other places might be rather tricky and well beyond search/replace.

Before:
Code:
       iHP = GetCharacterShipHP(PChar);
       ipassenger = GetCompanionIndex(pchar, 1);
       if (iPassenger > 0) iHP += GetCharacterShipHP(&Characters[iPassenger]);
       ipassenger = GetCompanionIndex(pchar, 2);
       if (iPassenger > 0) iHP += GetCharacterShipHP(&Characters[iPassenger]);
       ipassenger = GetCompanionIndex(pchar, 3);
       if (iPassenger > 0) iHP += GetCharacterShipHP(&Characters[iPassenger]);
After:
Code:
       for (i=1; i<COMPANION_MAX; i++) {
         iHP = GetCharacterShipHP(PChar)
         ipassenger = GetCompanionIndex(pchar,i)
         if (iPassenger > 0) {
           iHP += GetCharacterShipHP(&Characters[iPassenger])
         }      
       }
Whatever that function even does I don’t know. :unsure
 
Back
Top