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

Trying to get back into Modding

Phyones Arc

Landlubber
Hello me fellow Sailors!

I've recently gotten the game again and went straight into modding of course! Sad thing is, its been the better part of 5 years since I last modded the game. I tried to get meself a new custom ship but sadly had to realise I cant remember much. I got the model to work and such but Im just simply at a complete loss when it comes to changing the picture etc. I would appreciate it if someone could be so nice to give me a brief overview on what things in the seperate folders and files do (not everything in detail, but atleast what I need to know if I temper with items and ships) and what layout the shipinit.c follows or rather what each value means.

Also I read in a tutorial that yer can add items even after yer already have a save game, but I didnt understand a bit in what file and at what point I need to add that. Also is that possible with ships as well?

Thanks in advance! Good sailin'!
 
For the ship's interface picture, you will need to edit "RESOURCE\Textures\INTERFACES\shipsTM.tga.tx". (I'm assuming that you know how to edit .tga.tx files otherwise you wouldn't have a texture for that custom ship.) The other ship interface picture files are full now, but "shipsTM.tga.tx" has plenty of spaces available.

You'll also want a screenshot of the ship to use as the interface picture. You can see how other interface pictures look - a view of the ship from the port forward quarter, slightly up, in good weather and away from any island. Press F9 to get rid of all the game interface stuff, e.g. compass, status icon etc. Then press F8 to take a picture. You'll then have a file called something like "seadogs1.tga" at the top level of your game installation folder. Resize and crop it to a 250 x 250 square, preferably with feathered edges, then paste it into the interface picture file.

Next, you'll need to edit "RESOURCE\INI\TEXTS\INTERFACES\pictures.ini". Scroll down to the part which starts:
Code:
[SHIPS5]
sTextureName       = shipsTM.tga
wTextureWidth       = 2048
wTextureHeight       = 2048
Below that is a list of which ship corresponds to which part of the file. In particular, row 2:
Code:
;row 2
picture = GEN_Indefatigable,       0,257,256,512       
picture   = NL_Superbe,           257,257,512,512
picture   = BrigantineOld,       513,257,768,512
picture = FastGalleon5,           769,257,1024,512
picture = Sat_Essex,           1025,257,1280,512
picture   = PiratFrigateSat,       1281,257,1536,512
picture   = Frigate_Ex_Sat,       1537,257,1792,512
picture   =                1793,257,2048,512
The last space on row 2 of the file is clear. Put your ship model name into there.

Finally, in "Ships_Init.c", find the line in your ship's entry for 'refShip.BigPicTexName'. You'll see in "pictures.ini" that the part for "shipsTM.tga" starts with '[SHIPS5]'. So you want that line in "shipsInit.c" to read:
Code:
refShip.BigPicTexName   = "SHIPS5";

How much have you managed so far? Does the ship have an entry in "Ships_init.c"? Have you got it to appear in the game?
 
Wellcome back to the game @Phyones Arc!!! :cheers

what layout the shipinit.c follows or rather what each value means.
Lets take look at a ship i added: "PiratFrigateSat"

Code:
//-------------------------------------------------------------------------
// Rossiya 1728 by Armada - Satanist version by The Nameless Pirate
//     <SWS - Willemstad Builders' Trials Winter 09 S/N 144> (WBT1L)
//-------------------------------------------------------------------------
    makeref(refShip,ShipsTypes[n]);
    n++;
    refShip.Name            = "PiratFrigateSat";
    refShip.All             = "frigate1";
    refShip.SName            = "Frigate3";
    refShip.Nation            = PIRATE;
    refShip.unique            = true;
    refShip.id            = refShip.Name;
    refShip.Walk            = "Frigate";
    refShip.Class            = 5;
    refShip.Cannon            = CANNON_TYPE_LONG_LBS18;
    refShip.MaxCaliber        = 18;
    refShip.Weight            = Tonnes2CWT(1000);
    refShip.Capacity        = 2000;
    refShip.CannonsQuantity = 36;
    // NK cannon qtys 05-04-18 -->
    refShip.Cannons.Borts.cannonf.qty = 2;
    refShip.Cannons.Borts.cannonb.qty = 2;
    // NK <--
    refShip.MaxCrew            = 410;
    refShip.MinCrew            = 80;
    refShip.Price            = 210000;
    refShip.HP            = 3800;
    refShip.SP            = 200;

    refShip.BigPicTexName    = "SHIPS5"; // Armada

refShip.Name=name of ship in the files
refShip.All=type of ship dialog?
refShip.SName=accurate type of ship
refShip.Nation=nation that made this ship
refShip.unique=if the ship is unique
refShip.id=ships id
refShip.Walk=ships walk file name
refShip.Class=ships class
refShip.Cannon=cannons that come with the ship
refShip.MaxCaliber=max caliber of cannons
refShip.Weight=ships weight?
refShip.Capacity=ships cargo capacity
refShip.CannonsQuantity=number of cannons in all sides together
refShip.Cannons.Borts.cannonf.qty=number cannons in the front of the ship
refShip.Cannons.Borts.cannonb.qty=number cannons in the back of the ship
refShip.MaxCrew=maximum number of crew
refShip.MinCrew=minimum number of crew
refShip.Price=ships buying price
refShip.HP=ships Hull Points
refShip.SP=ships Sail Points
refShip.BigPicTexName=ships interface texture file name (not one file per ship)

EDIT: Made a few mistakes thanks @Grey Roger for correcting them!
So 'refShip.All" is basically a default. Any attributes which are not specified for this ship will be copied from here. In the case of your "PiratFrigateSat", anything not specified in its own entry will be copied from "Frigate1".

'refShip.SName' refers to "RESOURCE\INI\TEXTS\ENGLISH\common.ini". For "PiratFrigateSat", 'SName' is set to "Frigate3". In "common.ini" that translates to "Heavy Frigate". So if you look at the ship through a spyglass, it will show up as "Heavy Frigate".

'refShip.unique' is used for some special quest ships. Most ships will have their stats modified by their nation - the nation modifiers are also listed at the top of "Ships_init.c". Stats are also randomised a little so that no two ships are quite the same. If the ship has this 'unique' attribute then none of that happens and the stats are exactly what you see in "Ships_init.c".

'refShip.BigPicTexName' is not the texture file name. It refers to an entry in "pictures.ini", which shows both the name of the texture file and the ship's place in it.
 
Last edited:
Several of the entries in "Ships_init.c" are explained near the top of "Ships_init.c". ;) For example:
Code:
       -SName is for the ship's type name (this is displayed by spyglass, and by BigPic in interfaces),
           so you can have the same model but a different name. :) This is NOT directly displayed;
           it is run through XI_ConvertString, so you must have an entry for this in lang\common.ini
       *This is autogenerated (= *.name) on final loop if it does not already exist.

       -All is for all the above properties, as a shortcut. If this exists, at final loop all above are
           set equal to this. For properties != name, the appropriate property is found from that ship.
           If some properties are already set, they will not be overwritten (i.e. set all to one but
           define walk, all but walk will be overwritten by all's link).
So 'refShip.All" is basically a default. Any attributes which are not specified for this ship will be copied from here. In the case of your "PiratFrigateSat", anything not specified in its own entry will be copied from "Frigate1".

'refShip.SName' refers to "RESOURCE\INI\TEXTS\ENGLISH\common.ini". For "PiratFrigateSat", 'SName' is set to "Frigate3". In "common.ini" that translates to "Heavy Frigate". So if you look at the ship through a spyglass, it will show up as "Heavy Frigate".

'refShip.unique' is used for some special quest ships. Most ships will have their stats modified by their nation - the nation modifiers are also listed at the top of "Ships_init.c". Stats are also randomised a little so that no two ships are quite the same. If the ship has this 'unique' attribute then none of that happens and the stats are exactly what you see in "Ships_init.c".

'refShip.BigPicTexName' is not the texture file name. It refers to an entry in "pictures.ini", which shows both the name of the texture file and the ship's place in it.

Some more attributes:
'refShip.period': for each of the six periods, a number which shows how likely the ship is to appear in that period. 0.0 means the ship can't appear in that period, e.g. 'refShip.period.0 = 0.0' means the ship can't appear in "Early Explorers", while 'refShip.period.5 = 0' means it can't appear in "Napoleonic".
'refShip.england': a number which shows how likely the ship is to appear in an English group. Similar lines refer to other nations. Not to be confused with 'refShip.nation', which I believe is where you may be able to buy the ship in a shipyard. Except...

'refShip.CanBuy': if this is set to "true" then you can buy the ship. If it's set to "false", you can't. Quest ships such as the Black Pearl are never for sale! (Not quite true - if a ship is not allowed to be bought from a normal shipyard then there is one very special shipyard where you can buy it...)
'refShip.CanEncounter': if this is set to "true" then you may meet this ship in random encounters. If it's set to "false" then the only way you'll see it is if a quest calls for it.

If the ship can be encountered randomly:
'refShip.Type.Trade': the ship is a merchant. It will appear under a merchant flag with relatively weak crew and a full cargo hold.
'refShip.Type.War': the ship is a warship. It will appear under a naval flag with a strong crew and only such cargo as is needed to supply itself - ammo, repair materials and perhaps a small amount of trade cargo.
If both of these are set to "true" then the ship is "versatile". It can be either a merchant or a naval ship. The Heavy East Indiaman is such a ship.

'refShip.Model': if two or more ships have the same value here then they'll show up as alternatives in the shipyard's "Appearance" tab. For example, several frigates have the line 'refShip.Model = "Rossiya"'. These are the "Kreyser" types and if you have one, you can change it to any of the others in a shipyard. This only works properly if the ships really are the same in all but colour scheme. (There used to be a bug because the various caravel types had 'refShip.Model = "Caravel"', so you could repaint any caravel into any other. But they're not the same. The Caravela Latina has a different sail layout to the Caravela Redonda. Worse, "FastCaravel" had the same line, and that's the special caravel in the "Bartolomeu" storyline with different stats, which caused trouble if you repainted it to a basic caravel.)
 
Thanks a bunch guys!

I already got meself the textures and the gm files edited to use the new texture files I made. I also already got a new Entry in ShipsInit.c with all the stats needed, tho thanks to you I now figured out the unique problem thanks! When I come back from work today I'll check out the Icon problem, thanks for that. I thought it'll be something like what you explained, but I didn't figure it out until now so thanks :D

Got one other question tho for yer @Grey Roger, where can I find that shipyard? That would make it easier for me to get a whole squad of me unique ships.
 
So 'refShip.All" is basically a default. Any attributes which are not specified for this ship will be copied from here. In the case of your "PiratFrigateSat", anything not specified in its own entry will be copied from "Frigate1".

'refShip.SName' refers to "RESOURCE\INI\TEXTS\ENGLISH\common.ini". For "PiratFrigateSat", 'SName' is set to "Frigate3". In "common.ini" that translates to "Heavy Frigate". So if you look at the ship through a spyglass, it will show up as "Heavy Frigate".

'refShip.unique' is used for some special quest ships. Most ships will have their stats modified by their nation - the nation modifiers are also listed at the top of "Ships_init.c". Stats are also randomised a little so that no two ships are quite the same. If the ship has this 'unique' attribute then none of that happens and the stats are exactly what you see in "Ships_init.c".

'refShip.BigPicTexName' is not the texture file name. It refers to an entry in "pictures.ini", which shows both the name of the texture file and the ship's place in it.

Thanks @Grey Roger for correcting my mistakes and going over it in more detail!!! :cheers
I was a bit in a rush and for some reason my brain decided to mess with me.:modding

Got one other question tho for yer @Grey Roger, where can I find that shipyard? That would make it easier for me to get a whole squad of me unique ships.
If you don't mind spoiling it for you...
Go to Tortuga tavern, inside you will find Mr. Gibbs, speak to him, he will give you a very special compass.
Once you have the compass look for an Aztec coin on the 3D world map, go there the island's name will be Isla de Muerta.
Once you arrive there there are three shores one of them holds the path towards a cursed tresure, the other towards the shipyard, the door is on the washed ship, toward the bow of the ship if i remember correctly. And also the last coast holds a black-bearded death if you don't figure out something.
 
Another attribute or two, if you want to customise the ship further:
Code:
   refShip.EmblemedSails.normalTex = "sail_whole_red_plain.tga";
   refShip.EmblemedSails.nationFileName = "sail_whole_red_plain.tga";
You may have noticed that some ships don't have plain white sails. The Satanist ship in the "Strange Things Going On in the Archipelago" sidequest has red sails, and these are the lines which give those red sails. Alternatively:
Code:
   refShip.EmblemedSails.normalTex = "sail_petros_blue_white.tga";
   refShip.EmblemedSails.nationFileName = "sail_petros_blue_white.tga";
This gives the ship blue and white striped sails.

You can find the sail textures in "RESOURCE\Textures\Ships\Sails".

Alternatively, in the "Ship" part of the F2 interfaces, you can click on the sail to choose how you want the sails to look. This, of course, only applies to ships under your command!

Code:
   refShip.GeraldSails.rey_a2   = 1;
   refShip.GeraldSails.rey_a3   = 1;
   refShip.GeraldSails.rey_b2   = 1;
   refShip.GeraldSails.rey_b3   = 1;
If sails with emblems are chosen, GeraldSails are the ones which show them. They refer to the ship's spars. On this ship, if you've picked emblemed sails, the emblem will appear on the lower and middle sails of both the foremast and mainmast.
 
So thanks to you guys I got it working now! Only thing I need to do now is finding a program to edit tga files with, because if I use Gimp it breaks the file for some reason. The TX Converter wont accept it.

Apart from that is there a way to add ships to an already existing game? And how does it work for items anyway. I found this tutorial on here new-horizons-Adding-Items-During-Game | PiratesAhoy! but it doesnt say where exactly to put the code. If anyone could help me out with that I'd be most grateful :D
 
I use Gimp to edit .tga files, when you extract the file as .tga uncheck the RLE compression button. ;)
 
Also if it is just a model replacement the no new game is needed, as far as completely new ships go, you need a new game.

...or console magic, i remember reading something about that maybe a year ago, i will search the forum and come up with the answer, maybe @Grey Roger, @Pieter Boelen or @Jack Rackham remember it and answer faster than me.
 
Items are defined in either ITEMS/initItems.c if they are weapons, armor, medicals, maps or otherwise for more common use.
Specific quest items are defined in Storyline/"name of storyline"/items/initQuestItems.c.

If they do have a model weapons are placed in MODELS/Ammo and textures in Textures/Ammo.
Other models in MODELS/ITEMS and textures in Texture/Items.

Pictures of items see Texture/Interfaces: many item sheets here. Making a new sheet it has to be defined in RESOURCE/INI/INTERFACES/pictures.
Item describe texts are found in RESOURCE/INI/TEXTS/ENGLISH/ItemsDescribe for common items and in RESOURCE/INI/TEXTS/ENGLISH/storyline/"name of storyline"/ItemsDescribe for quest items.
 
Sooooo,

After a long week I finally had some time to read through this. Thanks for all the help, I figured out everything I needed for the new items in old saves and such. Next thing will be my own storyline, but I think that will be VEEEERY difficult...
 
The first problem with starting a storyline is setting everything up - I know from personal experience! You will need:
"PROGRAM\Storyline\storyname.c" - basic things such as the character's name and model, ship name and model, start date, etc.
"PROGRAM\Storyline\storyline - the folder where your storyline-specific work will go, containing:
"characters" - folder containing character definition files
"DIALOGS" - folder for dialogs specific to the storyline
"quests" - folder containing "quests_reaction.c" and "both_reaction.c". "both_reaction.c" just needs to exist, it doesn't need to contain any actual quest code - look at the one in "Hornblower" for a minimal version which you can copy. "quests_reaction.c" is the one where you'll do most of your quest coding.
"StartStoryline.c" - more code to set up starting conditions for the story

Optionally:
"items" - contains "initQuestItems.c", which defines objects specific to the storyline
"Locations" - contains "init\QuestLocations.c", defining custom locations for the storyline
If you don't have any story-specific items or custom locations, you don't need these​

Beyond that, it's a matter of building up "quests_reaction.c" as well as various dialog files to progress the story. Add a bit, play it, find out why it didn't work the way you expected, fix it, keep trying until it works. Then add the next bit and repeat.

The first thing I'd suggest is to play through an existing storyline. Every so often, save game and quit, then recall what has happened - and then look through the code to find out how it happened. You'll learn a lot about how the cases in "quests_reaction.c" are triggered that way. Look through "compile.log", particularly for lines which say '"Quest name <something> FOUND in QuestComplete" - they're the ones referring to quest cases from "quests_reaction.c". (Lines which say "CommonQuestComplete" instead of "QuestComplete" refer to quest cases which are not part of the story, e.g. getting free ammunition from a gunner. You can ignore those.) Don't use "Tales of a Sea Hawk", alias "standard", for this - the quest code is a mess and extremely hard to follow! Try "Assassin", "Bartolomeu" or "Hornblower", which are linear stories whose quest code is much easier to follow.

The second thing I'd suggest is, don't try to do it all at once. Get a part of it working, then upload it here so other people can try it out. Partly to show off what you've achieved, and partly because while you know what the player is supposed to do to play the story, the player might not, and if he does something you didn't expect, it might break the story. So a big part of story-writing is figuring out what a player can do wrong, then either preventing it or having the story recover somehow.

The first version of my "Ardent" storyline was very different from what you'll see today - you started the game, were arrested, escaped from prison, and that was it. Later versions added more, until it was finally complete - over a year later!
 
Back
Top