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

Change ships cabins in an existing game

Alloppatalle

Landlubber
I am trying to see if it is possible to change the ships cabins in a game that is already started (from a first preliminary test, I managed to change them in a new game).

Looking through the code, cabins are assigned to ships in Ships_init.c, and all the properties of these cabins are in boarding.c (there are actually 2 copies of this file, but from my tests only editing the one in "Locations\init" worked).

Now, what I have done using console.c, is:
  • Reinit ships
  • Reinit boarding locations

But this wasn’t enough, because the cabin of my ship didn’t change. I finally managed to change it regenerating my ship with pchar.Ship.Type = GenerateShip(SHIP_Name, true); in console.c.

I am not a programmer, and I have no knowledge of Storm Engine coding, so I’d like to know if it safe to change cabins like this.
And what happens to other ships of the same type? I regenerated the ship only for the main character, right (the pchar in the code)? So the others generated before the ships reinit still have the old cabins?
 
Specifically which game are you talking about?
The answer is different for different games.
 
In that case, I am not entirely sure.
Does that game have the cabins per ship specified in ships_init.c?
And does it have a reinitialize functionality?
 
In ships_init.c there are the ship-cabin associations in the form of refship.CabinType = "Cabin_Small";.
In boarding.c there is a block of code for every cabin that defines the paths to models, to locators, etc.

There is a reinit button in the mod options (it's GoF), but I successfully did a reinit of ships and boarding locations using console.c (I printed some of the updated values in game to be sure the reinit worked).

But my problem was that - even though I did a reinit of those 2 files - whenever I entered my cabin, the game still used the old one. From what I understood, my ship still had the old attributes (like name, cabin type, etc.), that don't get updated automatically after a reinit. So I had to regenerate my ship to see the new cabin.

Now I don't know if regenerating my ship is safe... it works, but will there be strange bugs? What I'm asking is if I can use the GenerateShip function to regenerate every ship I change the cabin to without problems...
 
I cannot vouch for that CoAS function, but I'll describe how it goes in PotC.
When you do a reinit, all newly generated ships get the new stats, but the ships that were generated already keep their old ones.
To update those too, you indeed need to regenerate those ships.
In PotC, I use a function that we wrote Isles for that named GiveShip2Character. That is probably functionally equivalent to that CoAS function you mention.
I think it works fine in PotC.

So I'd say: try that GenerateShip function in CoAS and see what happens.
With a bit of luck, it also works fine. And in the worst case, at least you'll know for sure that it doesn't.
 
In COAS when you make a change to a ship's stats a new game is required.

I get around that by starting a game where all ships are in the shipyard and the character has like $5,000,000 and then save. I make my changes and start a new game. Go buy the ship and outfit it and then go sailing to see how it does.

Rinse and repeat as needed.
 
I cannot vouch for that CoAS function, but I'll describe how it goes in PotC.
When you do a reinit, all newly generated ships get the new stats, but the ships that were generated already keep their old ones.
To update those too, you indeed need to regenerate those ships.
In PotC, I use a function that we wrote Isles for that named GiveShip2Character. That is probably functionally equivalent to that CoAS function you mention.
I think it works fine in PotC.

So I'd say: try that GenerateShip function in CoAS and see what happens.
With a bit of luck, it also works fine. And in the worst case, at least you'll know for sure that it doesn't.
I saw that GenerateShip is used to assign the ships to characters, so probably is similar to that GiveShip2Character in PotC...
Anyway, I will see what happens, as you suggested.

In COAS when you make a change to a ship's stats a new game is required.
Yea, I noticed that with this experiment of cabins. But I was able to change the stats anyway (at least, the CabinType) regenerating the ship; I just hope not to bug the game!
 
Back
Top