• 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

Phaser

Landlubber
Hiyas,

ok i have added a re textured ship and it does show up at the shipyard and does have its own little pic and all but the problem is if i buy it i get a CTD with no error report and if i encounter it at sea i get a CTD with a error report that says..

RUNTIME ERROR - file: sea_ai\AIShip.c; line: 516
missed attribute: speed
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 516
no rAP data

and if i load up the AIShip.c file in a spreadsheet and go to line 516 it looks like this...

rCharacter.Ship.Track2.Speed = rShip.Track2.Speed;


what am i missing here?

any thoughts would be helpful..
 
<!--quoteo(post=168010:date=Oct 18 2006, 09:50 AM:name=Thomas the Terror)--><div class='quotetop'>QUOTE(Thomas the Terror @ Oct 18 2006, 09:50 AM) [snapback]168010[/snapback]</div><div class='quotemain'><!--quotec-->
never got that report when i add a ship.
<!--QuoteEnd--></div><!--QuoteEEnd-->

well thats not very helpful is it thomas, the brig_rn does the same thing if you buy it from the shipyard as soon as ya try to leave it CTD's with the same error report
 
it does? i only use it as starting ship, if you want to know how to add it to the shipyard you should ask cyberops, he did it with the brig rn. (i made it, put it ingame, he made it available in the shipyards. If i use the ship as starting ship or capture it, it hasen`t got any problems.
 
<!--quoteo(post=168012:date=Oct 18 2006, 10:06 AM:name=Thomas the Terror)--><div class='quotetop'>QUOTE(Thomas the Terror @ Oct 18 2006, 10:06 AM) [snapback]168012[/snapback]</div><div class='quotemain'><!--quotec-->
it does? i only use it as starting ship, if you want to know how to add it to the shipyard you should ask cyberops, he did it with the brig rn. (i made it, put it ingame, he made it available in the shipyards. If i use the ship as starting ship or capture it, it hasen`t got any problems.
<!--QuoteEnd--></div><!--QuoteEEnd-->

i don't have any problems adding my ships to the shipyard the problem is after you buy it it CTD's when ya try to leave the shipyard
 
If ya start with the new ship its fine the issue is when you start with the starting ship the game gives ya (Lugger ) i beleive and go to the shipyard and sell it and buy the new custom ship as sson as ya try to exit the shipyard it CTD's with no error report and if you keep the starting ship (Lugger) and encounter the new custom ship at sea it CTD's with that error report in my 1st post.
 
Here is the guide I wrote to add new ships. The only thing missing when done is the 64*64 portraits and the computer can't tell the proper ship for the side bar, but otherwise I can buy the ship from the yard and sail them with no problems and I have reorganized the brig_rn, pinnace, and added 5 new ships.

Windwolf7s guide to adding new ships to Age of Pirates

Ships_init.c under \Program\ships – Make a copy of a the ships code that most closely matches your new ship in class and enter it in where a ship of that class belongs, i.e. Class 2 ships just after the frigate, class 1 after the manowar.
First you must change the ship ref to your new name.

makeref(refShip,ShipsTypes[SHIP_NEWSHIPNAME]); //Change to new ship class name.
refShip.Name = "Newshipname";
Then you can edit the other specs. Here are some of the specs I have successfully edited:

refShip.Class = 6; // Class can be changed but try to keep in order.
refShip.Cannon = CANNON_TYPE_CANNON_LBS24; //Starting cannons
refShip.MaxCaliber = 48; //Max the ship can take.
refShip.Weight = Tonnes2CWT(700); // For weight calcs like ramming.
refShip.Capacity = 15000; // Storage capacity, I've gone to 99000 on others.
refShip.MaxCrew = 90; //Max crew is ignored since the game calcs its own, but try to make total equal to all other crew. Calc is sailing+cannoneer+gunner+boarding.
refShip.MinCrew = 5; //Game also calcs as 10% of max.
refShip.BoardingCrew = 80; //Amount of crew for boarding.
refShip.GunnerCrew = 10; //Amount with guns.
refShip.CannonerCrew = 64; // Should match total cannons, 2 for each.
refShip.SailorCrew = 90; //Crew used for sailing.
refShip.SpeedRate = 70.0; //Over all speed.
refShip.TurnRate = 90.0; //Speed of turning.
refShip.Price = 1950; // Price base for shipyard.
refShip.HP = 88000; // Base Hp. I like this number since 10% increases don't change the layout of the specs screen as the muber goes to 6 digits.
refShip.SP = 99000; //Sail Hp. Increasing helps prevent storm damage to sails, but ramming and cannon fire are still calculated as percentages so use at discretion.
refShip.CanEncounter = false; //Adding this line,prevents the Ai from having this ship. Thanks Golan.
refShip.fWindAgainstSpeed = 40.0; // Ships ability to sail into wind. I think 40 is good.
refship.SpeedDependWeight = 0.01; //These are the ship to weight ratios, they control if ship is affected by the weight it is carrying. So reduce is ships is big or can carry a lot.
refship.SubSeaDependWeight = 0.01;
refship.TurnDependWeight = 0.01;

And thats it for the specs. Someone let me know if I missed something.

Next.

Ships.h under \Program\ships - Enter new ship ref here in the class it belongs. Renumber the other ships if need be, and change the line at the top:

#define SHIP_TYPES_QUANTITY 25// Total should be last ship number plus 1.

newshipname1_walk.c under \Program\sea_ai\walk – This is the walk file for 1st person view. Copy the class you modified off of and rename. Then open your new files and use the replace command to change every mention of the old ship to your new ship.

Shipname1.ini under \RESOURCE\Models\Ships\Sailorspoints - File to place lowpoly sailors. Again copy original and rename. No need to edit.

bortoutNewshipname1.tga.tx under \RESOURCE\Textures\Ships\Newshipname1 - textures for each level of hull armor. I would try not to make the referenced texture name longer than the orginal as you will have to hex edit new models to change referenced textures.

Model files under \RESOURCE\Models\Ships\Newshipname1 - Place to put new models or renamed copies of the model new ship is based off of. Edit the base model Newhipname1.gm with hex editor to change texture reference.

newshipname.tga.tx under \RESOURCE\Textures\INTERFACES\SHIPS - 128*128 portraits for F2 screen. Copy original ship portrait and rename or make new one.

Common.ini under \RESOURCE\INI\texts\english - Somewhere in the middle is the ship descriptions. Just add new ship same as the others. Keep in same order as ships.h.

utils.c under \Program\scripts – Look for these lines:

int iShipYardLevel = sti(colonies[FindColony(sLocation)].shipyard);

if (iShipYardLevel == 1)
{
iEndPoint = SHIP_WOLFOFWAR; // Change these to include new ships.
}

if (iShipYardLevel == 2)
{
iEndPoint = SHIP_WOLFOFWAR; // Change these to include new ships.
}

if (iShipYardLevel == 3)
{
iEndPoint = SHIP_WOLFOFWAR; // Change these to include new ships.
}

if (iShipYardLevel == 4)
{
iEndPoint = SHIP_WOLFOFWAR; // Change these to include new ships.
}

//trace("isl"+ iEndPoint);

int m = 2;
for (int i = SHIP_TARTANE; i <= SHIP_WOLFOFWAR; i++) // Change these to include new ships. This is how the shipyard determines what ships are available by starting with the tartane and ending with the last ship listed as endpoint. The endpoint should be the last ship on your list, in my case my Wolf of War class.


That should be everything to put a new ship into the game. The only thing missing is the 64*64 portraits for the scrollbars, which I can't find.

Let me know if I missed anything.

The game also randomizes some of the ship specs within 10%. I didn't like that so I changed it to only use the base specs. I can post that code if anyone is interested as well.
 
Hmm, there're quite a lot things missing in the Ships_Init.c section, aren't there?

Just copy and paste from the ship closest to your own, regarding size and sail layout. Then change, carefully, not in magnitudes...

btw: fWindAgainstSpeed = 40? What hell of a ship should that be? <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
I mean, the Tartane has 10, the Lugger 6 and the Schooner 8, so a value of 40 is far out of the line, don't you think?

So if you like realistic sailing, and especially if you use the realistic sailing mod in the last SuperMod, I would recommend value around 6 to 8 for Schooner rigged ships and value below 3 or even 2 for square riggers. A value of 40 would (I think) even crash the game or at least produce strange behaviour, because the fClosestPoint in AIShip.c would be below 0, which is not good...

Regarding the Track2.Speed thing: have you checked, if the value is set in your Ships_Init.c for the Brig_rn? In my version, there is an entry, but maybe there's not in yours?
 
Since i last posted i figured out my issues,i prefer to have the shipyards make available ships according to the size of the colony, so i think this is a better way than to force the shipyard to make your custom ship appear all the time,

scripts\utils.c

the shipyard code should stay according to the colony's starting level like this

void CalculateShipForShipYard(aref chr)
{
if(CheckAttribute(chr, "shipyard"))
{
return;
}

int iTest_ship;
int iBeginPoint, iEndPoint;
int iStep;
int iNation
string sStep;

DeleteAttribute(chr, "shipyard");

iTest_ship = rand(1);
chr.shipyard.ship1 = SHIP_TARTANE;

iStep = 2;
iNation = chr.nation;

string sLocation = pchar.location;
sLocation = Locations[FindLocation(sLocation)].fastreload;

int iShipYardLevel = sti(colonies[FindColony(sLocation)].shipyard);

if (iShipYardLevel == 1)
{
iEndPoint = SHIP_CARAVEL;
}

if (iShipYardLevel == 2)
{
iEndPoint = SHIP_GALEON_L;
}

if (iShipYardLevel == 3)
{
iEndPoint = SHIP_PINNACE;
}

if (iShipYardLevel == 4)
{
iEndPoint = SHIP_FRIGATE;
}

//trace("isl"+ iEndPoint);

int m = 2;
for (int i = SHIP_LUGGER; i <= SHIP_FRIGATE; i++)
{
iTest_ship = GenerateShip(i, 1);
sStep = "ship" + m;
chr.shipyard.(sStep) = iTest_ship;
if(i > iEndPoint)
{
chr.shipyard.(sStep).notforsale = 1;
}
m = m + 1;
}


as you can see at each level the yard will put out more ships or as the colony grows bigger

level 1 (outpost) will put out class 6-5 ships

level 2 (village) will put out class 6-4 ships

level 3 (Towns) will put out class 6-2 ships

level 4 (Large Towns) will put out class 6-1 ships

so basically when adding the ships to the Ship.h file add them according to class

EXAMPLE- (note this is just an example i only just figured out how the yard works)


Ships\ships.h


#define SHIP_TARTANE 0

#define SHIP_WAR_TARTANE 1

//6 <----------------------------------------------- class 6 ships here level 1 (outpost)
#define SHIP_LUGGER 2
#define SHIP_SLOOP 3
#define SHIP_BERMUDA 4

//5<------------------------------------------------ class 5 ships here level 1 (outpost)
#define SHIP_SCHOONER 5
#define SHIP_BARQUE 6
#define SHIP_CARAVEL 7

//4
#define SHIP_FLEUT 8
#define SHIP_BRIG 9
#define SHIP_BRIG_RN 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

//1
#define SHIP_LINESHIP 16
#define SHIP_WARSHIP 17
#define SHIP_BATTLESHIP 18

#define SHIP_MANOWAR 19


here is a screenshot of the yard at level 1 (outpost) as ya can see the new Bermuda ship i set it as a class 6 ship and it shows like its supposed to

<a href="http://home.earthlink.net/~phaser69/Shipyard.jpg" target="_blank">http://home.earthlink.net/~phaser69/Shipyard.jpg</a>
 
<!--quoteo(post=168063:date=Oct 18 2006, 01:45 PM:name=Hawkeye)--><div class='quotetop'>QUOTE(Hawkeye @ Oct 18 2006, 01:45 PM) [snapback]168063[/snapback]</div><div class='quotemain'><!--quotec-->
Regarding the Track2.Speed thing: have you checked, if the value is set in your Ships_Init.c for the Brig_rn? In my version, there is an entry, but maybe there's not in yours?
<!--QuoteEnd--></div><!--QuoteEEnd-->

Can you post the Trac2.Speed thing so i can see it there isn't an entry here on my side for the Brig_rn..

Thanks

****EDIT****

never mind i figured it out <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
<!--quoteo(post=168074:date=Oct 18 2006, 07:45 PM:name=Phaser)--><div class='quotetop'>QUOTE(Phaser @ Oct 18 2006, 07:45 PM) [snapback]168074[/snapback]</div><div class='quotemain'><!--quotec-->
****EDIT****

never mind i figured it out <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
<!--QuoteEnd--></div><!--QuoteEEnd-->

Do you mind, telling us? In case anyone else has the problem... <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
About what I figured, though wasn't yet sure just what all the files regarding a ship were.

Thanks Thomas.

Cap'n Drow
 
<!--quoteo(post=168063:date=Oct 18 2006, 01:45 PM:name=Hawkeye)--><div class='quotetop'>QUOTE(Hawkeye @ Oct 18 2006, 01:45 PM) [snapback]168063[/snapback]</div><div class='quotemain'><!--quotec-->
Hmm, there're quite a lot things missing in the Ships_Init.c section, aren't there?

Just copy and paste from the ship closest to your own, regarding size and sail layout. Then change, carefully, not in magnitudes...

btw: fWindAgainstSpeed = 40? What hell of a ship should that be? <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
I mean, the Tartane has 10, the Lugger 6 and the Schooner 8, so a value of 40 is far out of the line, don't you think?

So if you like realistic sailing, and especially if you use the realistic sailing mod in the last SuperMod, I would recommend value around 6 to 8 for Schooner rigged ships and value below 3 or even 2 for square riggers. A value of 40 would (I think) even crash the game or at least produce strange behaviour, because the fClosestPoint in AIShip.c would be below 0, which is not good...

<!--QuoteEnd--></div><!--QuoteEEnd-->

Your quite right as I pointed out those are options I have successfully changed. And also quite right those are not realistic values. I don't recommend higher that the values already used by other ships if you wish to maintain realistic sailing. Other wise they do work and you can a even a manowar dance like sloop.
 
Can anyone tell me how to mod a ship to go really well into the wind. I've messed around with the "fWindAgainstSpeed" in the ship_init file (using the same number as my base speed, multiples of my base speed and even negative numbers) but it makes no difference i still can't move against the wind.

Also need help texturing a completely new ship (same ship as above) but can't seem to get it to map correctly it just seems to wash the whole model with one colour which is a mixture of all the colours on your texture.

<img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />

PS it doesn't crash with numbers as high as 40 - i've tried -600 up to 1200
 
<!--quoteo(post=179000:date=Jan 14 2007, 05:40 PM:name=Thor the Bassist)--><div class='quotetop'>QUOTE(Thor the Bassist @ Jan 14 2007, 05:40 PM) [snapback]179000[/snapback]</div><div class='quotemain'><!--quotec-->
Can anyone tell me how to mod a ship to go really well into the wind. I've messed around with the "fWindAgainstSpeed" in the ship_init file (using the same number as my base speed, multiples of my base speed and even negative numbers) but it makes no difference i still can't move against the wind.

Also need help texturing a completely new ship (same ship as above) but can't seem to get it to map correctly it just seems to wash the whole model with one colour which is a mixture of all the colours on your texture.

<img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />

PS it doesn't crash with numbers as high as 40 - i've tried -600 up to 1200
<!--QuoteEnd--></div><!--QuoteEEnd-->

Ahoy Thor,

if you want your ships to be able to sail into the wind, don't use the realistic sailing option. Real ships don't sail directly into the wind. <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
<!--quoteo(post=179141:date=Jan 15 2007, 08:41 PM:name=Thor the Bassist)--><div class='quotetop'>QUOTE(Thor the Bassist @ Jan 15 2007, 08:41 PM) [snapback]179141[/snapback]</div><div class='quotemain'><!--quotec-->
which sailing option do you mean?
<!--QuoteEnd--></div><!--QuoteEEnd-->

Argh, wrong game, sorry... <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

Edit the AIShip.c in program\sea_ai\
The function Ship_UpdateParameters() does all the calculations. Beware that this is for all ships though!
 
Back
Top