• 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 Adding Unique Ships

Scorpion

Landlubber
I am trying to add a unique named ship to Age of Pirates: COAS (V1.3.0) game,
which I can buy from the shipyard, but I seem to have missed somthing and need help.
I added the ship to the Ship_init :
///////////////////////////////////////////////////////////////////////////
/// Frigate Grimreaper
///////////////////////////////////////////////////////////////////////////
makeref(refShip,ShipsTypes[SHIP_GRIMREAPER]);
refShip.Name = "Grimreaper";
refship.Soundtype = "frigate";

Gave it a number in the ships H file :
#define SHIP_XebekVML 23
#define SHIP_CORVETTE_QUEST 24
#define SHIP_ARABELLA 25
#define SHIP_FLYINGDUTCHMAN 26
//
#define SHIP_BOAT 27
#define SHIP_FORT 28
#define SHIP_GRIMREAPER 29

Added it to the net/common/Ships C file (because I read this needed to be done for it to appear in shipyard inventory):
///////////////////////////////////////////////////////////////////////////
/// Frigate Grimreaper
///////////////////////////////////////////////////////////////////////////
makeref(refShip, NetShips[n]); n++;
refShip.Name = "Grimreaper";
refship.Soundtype = "frigate";


And I added an entry into the AOP2/Program/battle_interface/Battleinterface C file :
case "Grimreaper":
BI_intNRetValue[0] = 4+3*8;
BI_intNRetValue[1] = 4+3*8 + 1;
BI_intNRetValue[2] = BI_ICONS_TEXTURE_SHIP1;
break;


Any help would be much appreciated.
 
Last edited:
First, make sure at the top of Ships\Ships.h that you increment the quantities by one for the new ship

#define SHIP_TYPES_QUANTITY 29
#define SHIP_TYPES_QUANTITY_WITH_FORT 30 // must be (SHIP_TYPES_QUANTITY + 1)

Also, given that some of the functions, like PGG_UpdateEquip look for all index entries below a certain number (e.g. less than SHIP_MANOWAR), I would actually put the new ship in the same area as a similar ship. Assuming it is similar to a Frigate, I would do this instead:

#define SHIP_TARTANE 0
#define SHIP_WAR_TARTANE 1

//6
#define SHIP_LUGGER 2
#define SHIP_SLOOP 3
//5
#define SHIP_SCHOONER 4
#define SHIP_BARQUE 5
#define SHIP_CARAVEL 6
//4
#define SHIP_BARKENTINE 7
#define SHIP_BRIGANTINE 8
#define SHIP_FLEUT 9
#define SHIP_BRIG 10
#define SHIP_GALEON_L 11
//3
#define SHIP_CORVETTE 12
#define SHIP_GALEON_H 13
#define SHIP_PINNACE 14
//2
#define SHIP_FRIGATE 15
#define SHIP_GRIMREAPER 16
//1
#define SHIP_LINESHIP 17
#define SHIP_WARSHIP 18
#define SHIP_BATTLESHIP 19

#define SHIP_MANOWAR 20

#define SHIP_SOLEYRU 21

#define SHIP_BRIGQEEN 22
#define SHIP_BRIGSW 23
#define SHIP_XebekVML 24
#define SHIP_CORVETTE_QUEST 25
#define SHIP_ARABELLA 26
#define SHIP_FLYINGDUTCHMAN 27
//
#define SHIP_BOAT 28
#define SHIP_FORT 29

You can ignore any changes to net/common/Ships file. It does nothing because it was supposed to be for the online version, which is defunct and does not do anything.

Instead, make sure it is initialized in Ships\Ships_init.c

makeref(refShip,ShipsTypes[SHIP_GRIMREAPER]);
refShip.Name = "Grimreaper";
refship.Soundtype = "frigate";
refShip.Class = 2;
//Add all the extra attributes of this ship, like cannons, crew, speed/turn rates, HP, SP, Track1, Track2, etc. Copy the frigate, or whatever ship this is a copy of...
...
...
...

In order to see the ship for sale in the yard, change scripts/ShipsUtilites.c. For instance, if similar to a Frigate, find that the Frigate becomes available (randomly, sometimes) after character rank 12:

void SetShipyardStore(ref NPChar)
{
...
...
...

if (sti(PChar.rank) > 12)
{
iTest_ship = rand(50);
if (iTest_ship == 1) FillShipParamShipyard(NPChar, GenerateStoreShip(SHIP_FRIGATE), "ship141");
if (iTest_ship == 2) FillShipParamShipyard(NPChar, GenerateStoreShip(SHIP_CORVETTE), "ship141");
if (iTest_ship == 3) FillShipParamShipyard(NPChar, GenerateStoreShip(SHIP_GRIMREAPER), "ship141");

iTest_ship = rand(70);
if (iTest_ship == 1) FillShipParamShipyard(NPChar, GenerateStoreShip(SHIP_FRIGATE), "ship151");
if (iTest_ship == 2) FillShipParamShipyard(NPChar, GenerateStoreShip(SHIP_PINNACE), "ship151");
if (iTest_ship == 3) FillShipParamShipyard(NPChar, GenerateStoreShip(SHIP_GALEON_H), "ship151");
if (iTest_ship == 4) FillShipParamShipyard(NPChar, GenerateStoreShip(SHIP_GRIMREAPER), "ship151");
}

...
...
...
}

Also be sure that the model and textures are in proper folder names in RESOURCE\MODELS\Ships\Grimreaper1 (make sure the 1 is there, even though named Grimreaper) and RESOURCE\Textures\Ships\Grimreaper1. Also, for sailors to walk around on deck, there should be a file made for ship in RESOURCE\MODELS\SAILORSPOINTS\Grimreaper1.ini.
 
Thanks for all the help. I didn't place the ship next to the Frigate and change all the numbers is because I wasn't sure if those numbers had a significance for reference in other programming.
The changes needed to the scripts/ShipsUtilites.c and the things in RESOURCES were what I wasn't aware were needed.
Also, in regards to the changes in RESOURCES; is all I need to do is make copies of the relevant files and just rename them to the named ship?
in this case copying the Frigate1 files/folders and renaming them to Grimreaper1 ? Because that is what I did, and I will have to test the changes later.

The changes seem to work fine , but there is no ship portrait or ship icon in my characters ship screen. Is there a way to fix this?
 
Last edited:
Just the model parts; the texture names remain the same as whatever they are copied from, but in their own Ships folder. The ship portrait and icon are separate and are done elsewhere.

For the icon, script file battle_interface\BattleInterface.c, function SetShipPictureDataByShipTypeName(int nType)

Copy a similar class/type of ship "case" block, paste an addition, then substitute your SHIP_GRIMREAPER:

Code:
case SHIP_GRIMREAPER:
        BI_intNRetValue[0] = 4+3*8;
        BI_intNRetValue[1] = 4+3*8 + 1;
        break;

For the portrait, you need a texture in Textures\INTERFACES\SHIPS with the ship name Grimreaper.tga.tx.
 
OK, I got the portrait to appear, but I still have no visible ship icon.
I place the below code in the AOP2/Program/battle_interface/BattleInterface C file
code:
case "Grimreaper":
BI_intNRetValue[0] = 4+3*8;
BI_intNRetValue[1] = 4+3*8 + 1;
BI_intNRetValue[2] = BI_ICONS_TEXTURE_SHIP1;
break;

This was the only battleinterface C file which had the relevant ship coding. I just copy/pasted the frigate lines and renamed it to the ship I wanted.
 
Back
Top