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

Need help to modify some Ships

darkevil

Sailor
Hello,

I seek the knowledge of those savant persons to enlight my lantern...

I was trying to add a new ship in "PROGRAM\Ships\Ships_init.c" mixing some features from different Satanist Frigates stats.
I added my modified version, changing refShip.Name then trying to load it by the console.

Unfortunately, that never works, even if i duplicate one ship (let say PiratFrigateSup) changing refShip.Name and try to load it. Nothing happens.

I'am a little bit confused. Any one have a clue to help me ?
 
Last edited:
Did you start a new game after changing "Ships_init.c"? Or, in an ongoing game, pressing F11 to re-initialise various parts of the game should reload "Ships_init.c".

If neither of those works, start a new game, then post the files "compile.log", "system.log", and "error.log" if it exists.
 
I tried to press F11 key.
Starting a new game.

But that isn't solve anything.
Unfortunately, there is nothing in error.log except this line :

[2024-02-26 14:09:52.998] [error] [error] COMPILE ERROR in ships\ships_init.c(14023): Undeclared identifier: f,

I just tried to duplicate the Satanist Frigate by changing some feature (like cannon caliber, Ship capacity and so on.
I had copied just under the code i put in Ships_init.c

Code:
//-------------------------------------------------------------------------
//        Test duplicate and modify Frigate Satanist version
//--------------------------------------------------------------------

    makeref(refShip,ShipsTypes[n]);
    n++;
    refShip.Name            = "COB_Frigate_Dark";
    refShip.All             = "frigate1";
    refShip.SName            = "Frigate3";
    refShip.Nation            = PIRATE;
    refShip.unique            = true;
    refShip.id                = refShip.Name;
    refShip.Walk            = "Frigate";
    refShip.Class            = 4;
    refShip.Cannon            = CANNON_TYPE_LONG_LBS24;
    refShip.MaxCaliber        = 24;
    refShip.Weight            = Tonnes2CWT(1500);
    refShip.Capacity        = 3500;
    refShip.CannonsQuantity = 44;    // was 42, two missing guns added

    //  cannon qtys 24-02-2024 -->
    refShip.Cannons.Borts.cannon-f.qty = 2;
    refShip.Cannons.Borts.cannonb.qty = 4;
    // <--

/*    refShip.CannonsQuantity = 36;
    // NK cannon qtys 05-04-18 -->
    refShip.Cannons.Borts.cannonf.qty = 2;
    refShip.Cannons.Borts.cannonb.qty = 2;
    // NK <--
*/

    refShip.MaxCrew            = 360;
    refShip.MinCrew             = 72;
    refShip.Price                   = 250000;
    refShip.HP                      = 4200;
    refShip.SP                      = 280;

    refShip.BigPicTexName    = "SHIPS5"; // Armada
    refShip.EmblemedSails.normalTex = "sail_whole_red_plain.tga";
    refShip.EmblemedSails.nationFileName = "sail_whole_red_plain.tga";

    refShip.BI.Tex = 10;
    refShip.BI.Pic = 1;
    refShip.QDeck = "ShipDeck1";
    refShip.CannonsDeck = 1;
    refShip.CargoHold = 1;
    refShip.Cabin = "Cabin_medium";
    refShip.Flags.Mast0.Flag1 = FLAG_PENNANT;
    refShip.Flags.Mast2.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast3.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast4.Flag1 = FLAG_PENNANT;

//Period
    refShip.period.0 = 0.0; //
    refShip.period.1 = 0.0; //
    refShip.period.2 = 0.01; //
    refShip.period.3 = 0.01; //
    refShip.period.4 = 0.01;//
    refShip.period.5 = 0.0; //

    refShip.Model = "Rossiya_Sat";
    refShip.Type.Trade = false;
    refShip.Type.War = true;
    refShip.CanEncounter        = false;
    refShip.CanBuy            = false;

    refShip.WaterLine = 0.3;
    refShip.SpeedDependWeight = 0.3;
    refShip.SubSeaDependWeight = 1.0;
    refShip.GeraldSails.rey_b2    = 1;
    refShip.GeraldSails.rey_b3    = 1;
    refShip.Type.Trade = false;
    refShip.Type.War = true;
 
// Stays, lateen and deep draft, better than average upwind performance
    refShip.ClosestPoint = 0.28;
    refShip.BestPoint = 0.8;

    // KK refShip.RigType = sDet;
    if(iRealismMode>0 || REALISTIC_SHIP_INERTIA){
        refShip.SpeedRate        = 15.8;
        refShip.TurnRate        = 98;
        refShip.InertiaAccelerationX    = 4;    refShip.InertiaBrakingX        = 0.5;
        refShip.InertiaAccelerationY    = 2.2;    refShip.InertiaBrakingY        = 0.5;
        refShip.InertiaAccelerationZ    = 2.5;    refShip.InertiaBrakingZ        = 2.0;
    }else{

        refShip.SpeedRate        = 15.8;
        refShip.TurnRate        = 74;
        refShip.InertiaAccelerationX    = 0.2;    refShip.InertiaBrakingX        = 2.0;
        refShip.InertiaAccelerationY    = 10;    refShip.InertiaBrakingY        = 4;
        refShip.InertiaAccelerationZ    = 4.0;    refShip.InertiaBrakingZ        = 2.0;
    }

I was figuring that some minor change will works without any issue and without log i don't see what is wrong.
 
At a guess, "Undeclared identifier: f" means the game doesn't like this:
Code:
refShip.Cannons.Borts.cannon-f.qty = 2;
Why did you change "cannonf.qty" to "cannon-f.qty"?

Also, have you copied the ship model in "RESOURCE\MODELS\Ships" to a new ship named "COB_Frigate_Dark"? If not, you'll probably get errors and possibly a game crash if you try to use that ship. If you want to use the "PiratFrigateSat" model, change:
Code:
refShip.Name            = "COB_Frigate_Dark";
... to...
Code:
    refShip.Name            = "PiratFrigateSat";

And change:
Code:
refShip.id                = refShip.Name;
... to...
Code:
refShip.id                = "COB_Frigate_Dark";

That should give you a new ship type which looks the same as the regular "PiratFrigateSat" but which has your new stats.

However:
Code:
refShip.CannonsQuantity = 44;
... and...
Code:
refShip.Cannons.Borts.cannonb.qty = 4;
... might not do you any good. The ship model only has 16 firing locators on each side, 2 forward and 2 astern. By comparison, "Frigate_sat" has 19 firing locators on each side, 2 forward and 4 astern. And that's why "PirateFrigateSat" has 36 cannons total while "Frigate_sat" has 44. You can put whatever you like into "Ships_init.c" but if the ship doesn't have enough firing locators, you'll still probably only get 36 guns firing.
 
Now is almost working nicely/
I follow your advice and i change

refShip.Name = "COB_Frigate_Dark";
to
refShip.Name = "Frigate_sat";
because the model Frigate_sat is more accurate (having more guns) with the ship i wanted to build (a powerful, fast and nasty frigate build for fighting).

then i changed
refShip.id = refShip.Name;
to
refShip.id = "COB_Frigate_Dark";

I just upgraded speed, hull, ship cargo and MaxCaliber 12 to 24
I lowered MaxCrew.

I had to press F11 before loading this ship but i got it.

I just have a little problem remaining i don't have the picture of the ship into the interface :

image_2024-02-26_233145858.png


i dunno where to find the pictures to illustrate this ship.

if you have any clue.
anyway thanks for your help ; that enlightened me a lot; i loose the knowledge to who modify the game (was a little bit active in the old days)
 
Try renaming "RESOURCE\MODELS\ships\COB_Frigate_dark" to something else. Don't rename all the files - the whole point is to prevent the game from finding the file if it's looking for "COB_Frigate_dark". If you've left 'refShip.Name' as "Frigate_sat" and changed 'refShip.id' to "COB_Frigate_Dark" then you should end up with a ship that the game can use as "COB_Frigate_Dark" but which uses the unmodified "Frigate_sat" model. If that works then you can remove "RESOURCE\MODELS\ships\COB_Frigate_dark" - there's no point in wasting disk space on an exact copy of the same ship model if your version can be made to use the "Frigate_sat" model.

The interface picture is set by this line in "Ships_init.c", in the definition for "Frigate_sat":
Code:
refShip.BigPicTexName    = "SHIPS2"; // Armada
That references "RESOURCE\INI\INTERFACES\pictures.ini", specifically the section which starts:
Code:
[SHIPS2]
sTextureName        = shipsTR.tga
wTextureWidth        = 2048
wTextureHeight        = 2048
The easiest way to get an interface picture for your ship, since it's a copy of "Frigate_sat", is to find this line:
Code:
picture = Frigate_sat,                  1281,1025,1536,1280
Copy it and change the copy:
Code:
picture = COB_Frigate_Dark,                  1281,1025,1536,1280
Your ship should then use the same interface picture as "Frigate_sat".

I just upgraded speed, hull, ship cargo and MaxCaliber 12 to 24
I lowered MaxCrew.
You might want to increase MaxCrew, not decrease it. There's a mechanism in the game for working out how much of the crew is available to sail the ship. Larger guns need more crew. 24 pound cannons will take longer to reload than 12 pound cannons anyway, but if you're short of crew, they may take even longer, and the rest of the undersize crew may also take longer to change sails.
 
Interesting, someone should make basic guides on the web on how to modify not so basic things, or at least what someone has independently discovered by modifying something, for example i "cant seen" topics regarding crew morale, and the solution had no effect on my game, i tried a new game and f11 and it didn't work, why not use the curse effect, without the need for morale/need/pay?, or at least another solution, slaves, i have boarded your pirate ship, now you are slave crew members. It's just a suggestion. Regards.
 
Back
Top