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

Adding Ships to Build 10.0+

On adding ships when using the PRS2 system (active since Build 10, or maybe 9. I forget. But, anyway, it's surely in 11.)

A ship for PRS2 must have the following things assigned.
*the ID. This must be unique to the ship. Also, you must add this to the ships lookup table.
*the model name.
*the type name (frigate, brig, etc.)
*the Battle Interface pic (the tiny pic you see during battle)
*the regular interface pic (the big pic you see in interfaces)
*a walk file, for the little people.

It may also have special NK/HFM toggles (see below).

Note that IDs, like any other string property, must be given in quotes. However, one may "add" (concatenate) strings together. And, for ships predating PRS2, to ease in my adding IDs, I took advantage of this to autogenerate them as the model name, and then, if the ship has a nation, an underscore and the nation number.
A note on the nation number. POTC uses numbers for nations.
These are defined in Globals.c, as follows:
Code:
#define ENGLAND 	 0

#define FRANCE 	 1

#define SPAIN 	 2

#define PIRATE 	 3

#define HOLLAND 	 4

#define PORTUGAL  5

What a #define does is tells the compiler to substitute the second piece for the first piece every time the first is found in code. So if, _outside quotes_, ENGLAND is found in a C file, 0 will be substituted on launching POTC.

So, I wrote the IDs as follows, accessing two `previously-defined` attributes of the ship (model name and nation)
ship.id = ship.name + "_" + ship.nation;
(which would lead, for the English Lugger2, to "Lugger2_0").

Now, the power of PRS2 for adding ships is that, for each of the properties above but the ID and model name, we can reference other ships for those properties, or use a special property (all) to make things even easier. The all property is set as the ID of another ship--note that this other ship must appear _above_ the new ship--and will use the above properties of that ship.
But you can also manually set other properties, in which case they'll overwrite the "all" call.

Note that if a property is not assigned, and refship.all is not assigned, then the property will default to the ship's model name. This is what happens for all stock POTC ships.

Note 2: If you want to add new entries to pictures.ini for the ship (and have the textures for those entries), you then set those properties (BIPic, the two BigPic ones) accordingly.

Here's how it works.

Let's say we're adding Catalina's Xebec CT. (ships_init.c)
First, we get a new ship in the array, and advance the counter.
Code:
makeref(refShip,ShipsTypes[n]);

n++;
Next, we give it an ID.
Code:
refShip.id = "XebecCT";
And add an entry to the ships lookup table based on that ID (this is required!)
Code:
curid = refShip.id; ShipLookupTable.id.(curid) = `n-1`; // PS
Then, we assign a model directory.
Code:
refShip.name = "XebecCT";
Next, we tell it to get all properties from the English Xebec1:
Code:
refShip.all = "Xebec1_0";
But, we overwrite sname (it'll have a different type name).
Code:
refShip.sname = "XebecCT";
NOTE: We must then add a XebecCT entry to common.ini!

Since the Xebec CT will be used by all nations, we do _not_ add a refShip.nation property. If we wanted it to be used only by pirates, however, we would add:
Code:
refShip.nation = PIRATE;
Note that PIRATE is _outside quotes_, and is thus changed to the integer 3 on running POTC, as it should. Make sure that if you add a nation to a ship the nation number define is _outside_ quotes.

Now, we can assign the regular ship properties. It's suggested you take an existing ship and copy/paste, and then change what stats you want to.
Code:
	refShip.Class   = 4;

refShip.Cannon   = CANNON_TYPE_CANNON_LBS16;

refShip.MaxCaliber  = 24;

refShip.Weight   = Tonnes2CWT(250);

refShip.Capacity  = 1600;

refShip.CannonsQuantity = 20;

refShip.MaxCrew  = 125;

refShip.MinCrew  = 20;

refShip.SpeedRate  = 14.5;

refShip.TurnRate  = 50;

refShip.Price   = 33000;

refShip.HP    = 2100;

refShip.SP    = 100;

refShip.AbordageLocation = "BOARDING_XEBEC";



refShip.WaterLine = 0.0;

refShip.SpeedDependWeight = 0.2;

refShip.SubSeaDependWeight = 0.2;

refShip.TurnDependWeight = 0.4;



refShip.CanEncounter	= true;  //if you don't want the ship to be encounter change this to false

refShip.Type.War = true;

refShip.Type.Trade = false;



refShip.InertiaAccelerationX	= 1.5;	refShip.InertiaBrakingX  = 2.0;

refShip.InertiaAccelerationY	= 15;	refShip.InertiaBrakingY  = 10;

refShip.InertiaAccelerationZ	= 9.0;	refShip.InertiaBrakingZ  = 6.0;

Now, we have to take the NK/HFM mod into account.
This mod makes some changes to every ship's stats, and assigns rig type and best / closest point of sail.
There are four ways to interface your ship with NK/HFM.
The first, and simplest, is to add nothing. Your ship will be processed based on its model name, as if it were a stock POTC ship. This XebecCT will processed like other Xebecs (Lateen rig, +3kts max speed, +5 degrees turn rate, war and trade type, accel and braking x0.25 and x0.1 respectively) if we add no switch.
Note that all ships receive the same accel/braking mods; however, type and stat changes, and rig assigns, are model name specific.

The switches available are:
No_NK_HFM
No_NK_HFM_modstats
No_NK_HFM_modaccel
No_NK_HFM_modtype

The first is the simplest. Just add
Code:
refShip.No_NK_HFM = true;
in your ship definition.
Note: if the first three letters of the ship's model name are not recognized by NK/HFM (i.e. no stock POTC ship model starts that way) you will have to add this switch!

HOWEVER: If you add this switch, you will have to add the above stuff manually or POTC will do weird things.
So, if you add that switch, you will need to divide your Z Accel by 4 and your Z braking by 10, and you will need to assign rig stats.
Rig stats are as follows.
First, there's rig type. This is based on the first three letters of the model's name (exception: Galeoth's rigtype is "Gat").
Code:
refShip.rigtype = "Xeb";

Then, there's closest and best point of sail. This is based on the type of masts and sails used, as follows:
Code:
Type:   	 Closest Point / Best Point of Sail

`Gaff-riggers` (sloops, schooners):	0.15	0.625

Lateen (Xebec, Tartane): 	 0.2	0.6

Luggers (Lugger, Galeoth):  0.225	0.625

`Full-rigged` ships (Corvette, Frig):	0.3	0.8

`Old-Time` `square-riggers` (Caravel,	0.375	0.875

Galleon, MoW, anything without Jibs)

So we'd use:
Code:
refShip.ClosestPoint = 0.2;

refShip.BestPoint = 0.6;

Note for the sailors: These are given as percents of max `off-wind`, so 1.0 is running before the wind and 0 is into the eye. The above are also _way_ generous.
And I'd love better numbers to use!

The other NK/HFM switches are to selectively disable pieces. So if you want rigtype assigns and accel changes to be done by NK/HFM but want the stats to stay unmodified and set the ship's type yourself (as we do for the Xebec CT) we would add the following:
Code:
refShip.No_NK_HFM_modstats = true;

refShip.No_NK_HFM_modtype = true;

That's it!

Description of specific properties added by PRS2:
These override refShip.name for each case
-Walk is for the big walktype switch in shipwalk.c. Case for this must exist there.
*This is autogenerated (= *.name) on final loop if it does not already exist.

-BIPic is the little pic in Battle Interface (i.e. when sailing). Case for this must exist in BI.c (battleinterface.c)
*This is autogenerated (= *.name) on final loop if it does not already exist.

-BigPic is the big pic name (in Ships, hold, shipyard, etc.) Must have matching entry in pictures.ini
*This is autogenerated (= *.name) on final loop if it does not already exist.

-BigPicTex is for GetShipTexture() and is -1 for unused, 1 for Galeoths (and BP/Fearless) and 0 for else.
*This is autogenerated (= 0) on final loop if it does not already exist.

-BigPicTexName is for GetShipTextureName() and is "", "SHIPS1", and "SHIPS16" respectively as above.
*This is autogenerated (= SHIPS16) on final loop if it does not already exist.

-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. xD: This is NOT directly displayed; it is run through XI_ConvertString, so you must have an entry for this in langcommon.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).
*THE SHIP LINKED TO MUST ALREADY HAVE BEEN PROCESSED!
 
Heh, but you started with talking about the LuggerCT and end up talking about the XebecCT... :facepalm :cheeky

Please don't forget to PM me about my Fred Bob character stats &tc...

I am also beating my skull against my monitor trying to get a relocation thing to work AGAIN (this time with Estrella)... She just doesn't want to move!!! (urgh!)

Well, back to the drawing board... :cheers xD:
 
xD: I'm glad YOU understand it, Cat! I'm... lost... :cheers:

Like, what file or files does this editing take place in?

I've done a skin for a corvette, and I've just finished one for the Fearless. I'd like to add them as new ships that dont take the place of existing ships... I'm going to look at your xebec and lugger, but what text files do I need to edit?
 
Will you integrate some new ships in the next build? Or... have you put some new ships in the 11??
 
Sailor_Al said:
Like, what file or files does this editing take place in?
Read carefully, Sailor Al, Nathan mentions the files - I'll highlight them for ya...

Sailor_Al said:
I've done a skin for a corvette, and I've just finished one for the Fearless. I'd like to add them as new ships that dont take the place of existing ships... I'm going to look at your xebec and lugger, but what text files do I need to edit?

Noted above highlighted in red... xD:

Hope this helps!!! :cheeky xD:

If you're still stuck, ask, I'll try to give further clarification. xD:
 
dHerblay said:
Will you integrate some new ships in the next build? Or... have you put some new ships in the 11??

There are some new "weathered skins" ships in the new build along with my two `re-skinned` XebecCT and LuggerCT - some of the stats are changed on the XebecCT, it is a nice roomy, speedy boarding Xebec!

As for the expansion package, there are a lot of shipaholics working hard to integrate new ships into the expansion package - so they'll either come sooner than the expansion release, or right with it. :cheeky xD:
 
Eh? SFAIK the weathered ships aren't in...

Sailor Al: All you really need to edit is ships_init.c
You can copy and paste an existing ship entry, change the refship.name line to point to the new model, and add refship.all = "corvette1_0"; if it's a corvette (or frigate1_0 if frigate, etc), and you're done.

The other stuff is for extra tweaking. :shock:

But, feel free to give a holler if you have any other questions/trouble whatever. xD:
 
hey Nathan

just tried to add my ship dFRIGATE (skin exsist. in potc)

I copied the settings from frigate2

added as you posted.

and added a dir dfrigate with the others (gm)

but now its going wrong ...

started the ship in buildsettings ...
and got myself a runtime error ...

do you have any suggestions ?
 
Dear Nathan ....... to you too .... (just posted in `Re-text`-tutorial)
This is just so nice ........
It works ...... and My English Fleet can be added soon.
My Hat is off to You and the Duke
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/cheers.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="cheers.gif" />: <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_praise.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="icon_praise.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/cheers.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="cheers.gif" />:
 
Our pleasure. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

What was the problem?
 
writing some wrong code and started the ship in the game .....
so it could of course NOT read the files right ..... and a CTD ....
thats my believe
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/cheers.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="cheers.gif" />:
 
Funny, I was just thinking that, when reading it over. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />
 
I think it is in the wiki already. I read this before when I was adding the various small vessels.
 
Back
Top