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

Thankyou! and Ship Berthing

O my god!... That's the last place i'd look in... Seriously, AI? :no
Case solved - just change the minimum closest point to 0.1(works with a gaff schooner, should work with others too, but i'll test it anyway):
Code:
if ( fClosestPoint < 0.1 ) { fClosestPoint = 0.1; }

Some smaller values might work too. Ill get back to you with the correct value.


I was wrong. Since the impact of the upgrade is random I must have gotten a small one. 0.1 ships(sloops) are faulty. seems like anything less than 0.15 is bad. Still, it seems there is no point at which things go bad, it's just that 0.14 is slightly worse(faster) than 0.15, 0.13 is slightly faster than 0.14 and so on. 0.1 and less is just ridiculous. IMO:
-sloops should be 0.15
-minimum cp after stays should be 0.15

Although it limits the use of stays on some ships, on a gaff schooner with 14.4 speed and 0.14 cp I can go ~21kns in 30kns wind, while with 0.15 cp I can go 18.6 kns. This seems to be the point where speed increases become significant. 0.16 cp schooner can go 17.8 kns.
 
When I'm not sure where code is, I just search the entire PROGRAM folder for something that might be in there. That's how I found this reference.
 
The actual upgrades and their effect (and its randomness) are set in internalsettings.h, if that helps

// ---- ADD ONS ---- All need shipyards. All can take out.

//Copper plates
#define CPSPEEDRANGEMAX 5 // int 0-100
#define CPSPEEDRANGEMIN 0 // int 0-100
#define CPTURNINGRANGEMAX 2 // int 0-100
#define CPTURNINGRANGEMIN 0 // int 0-100
#define CPINERTIARANGEMAX 0 // Not implemented
#define CPINERTIARANGEMIN -5 // Not implemented
#define CPTIMEMULT 1 // Time to repair all hull multiply by CPTIMEMULT
#define CPDISP 5 // int 0-100 Chance of being available
#define CPCOSTMULT 0.5 //Ships price * CPCOSTMULT

//Bronze cannons
#define BCACC 10.0 //float 0-100 increase of accuracy
#define BCRELOAD 10.0 //float 0-100 decrease of reload time
#define BCCRITICALCANNON 2.0 //float Multiplies the chance of loss a normal cannon
#define BCWEIGH -5 //Not implemented
#define BCDISP 10 // Availability
#define BCCOSTMULT 5 // Cannons price per BCCOSTMULT

//Good chasers
#define GCACCADD 10.0 //float 0-100 - increase of accuracy
#define GCRANGEADD 1.1 //increase of speed - be careful: too big and the Fantoms will not aim correctly
#define GCSAILCRIT 8.0 //float 0-100 - % of sail crit - to be added to CSAILCRIT
#define GCMASTCRIT 20.0 //float 0-100 - % of mast crit
#define GCDISP 10 // int 0-100 Chance of being available
#define GCCOSTMULT 5 // GCCOSTMULT * rcannons.cost(depending cannons fitted) * 2

// Common chasers
#define CSAILCRIT 5.0 //float 0-100 - % of sail crit
#define CSAILCRITDMG 4.0 // Damage multiplier if sail crit , either with chasers or good chasers
#define CMASTCRIT 15.0 // float 0-100 - % of mast crit

// Guns
#define MASTCRIT 8.0 //float 0-100 - % of mast crit

//New sails and ropes
#define NSSPEEDRANGEMAX 5 //int 0-100
#define NSSPEEDRANGEMIN 0 //int 0-100
#define NSSAILHPRANGEMAX 10 //int 0-100 % of damage reduction
#define NSSAILHPRANGEMIN 0 //int 0-100
#define NSINERTIARANGEMAX 0 //Not implemente
#define NSINERTIARANGEMIN -10 //Not implemente
#define NSTIMEMULT 1 // Time to repair all rigging multiply by NSTIMEMULT
#define NSDISP 25 // int 0-100 Chance of being available
#define NSCOSTMULT 10 // Cost of repair all rigging multiply by NSCOSTMULT

//Long top-masts
#define TMSPEEDRANGEMAX 10 //int 0-100
#define TMSPEEDRANGEMIN 0 //int 0-100
#define TMINERTIARANGEMAX 0 //Not implemente
#define TMINERTIARANGEMIN -10 //Not implemente
#define TMSAILCRIT 4 //int 0-100 increase of % of mastcrit
#define TMTIMEMULT 1 // Time to repair all rigging multiply by TMTIMEMULT
#define TMDISP 15 // int 0-100 Chance of being available
#define TMCOSTMULT 5 //Cost of repair all rigging multiply by TMCOSTMULT

//Staysails
#define SSTACKRANGEMAX 0.0 // float 0 - 1 Degrees of improve ClosestPoint - remmeber that ClosestPoint goes from 0 to 1
#define SSTACKRANGEMIN -0.1 // float 0 - 1 Degrees of improve ClosestPoint - remmeber that ClosestPoint goes from 0 to 1
#define SSTURNINGRANGEMAX 5 // int 0-100
#define SSTURNINGRANGEMIN 0 // int 0-100
#define SSTIMEMULT 1 // Time to repair all rigging multiply by SSTIMEMULT
#define SSDISP 3 // int 0-100 Chance of being available // Rare
#define SSCOSTMULT 10 //Cost of repair all rigging multiply by SSCOSTMULT

//Reinforced Hull --- No way back!!!!
#define RHHULLHPRANGEMAX 10 //int 0-100
#define RHHULLHPRANGEMIN 0 //int 0-100
#define RHINERTIARANGEMAX 10 //Not implemente
#define RHINERTIARANGEMIN 0 //Not implemente
#define RHCALIBERADD 1 // Number of calibers up
#define RHTIMEMULT 1 // Time to repair all hull multiply by RHTIMEMULT
#define RHDISP 50 // int 0-100 Chance of being available // Rather easy
#define RHCOSTMULT 0.2 // Cost of repair all hull multiply by RHCOSTMULT

// Pirate "flush" of ships - reduce the superstructure of captured ships in order to make them more "frigate-like"
// Need pirate or smuggler shipyard
// Just One way and only once in a ship
// Should change the model of ship in certain cases???

#define FLUSHSPEEDRANGEMAX 10 //int 0-100
#define FLUSHSPEEDRANGEMIN -2 //int 0-100
#define FLUSHTURNINGRANGEMAX 10 //int 0-100
#define FLUSHTURNINGRANGEMIN -5 //int 0-100
#define FLUSHHULLHPRANGEMAX 1 //int 0-100
#define FLUSHHULLHPRANGEMIN -5 //int 0-100
#define FLUSHLOADRANGEMAX -1 //int 0-100
#define FLUSHLOADRANGEMIN -7 //int 0-100
#define FLUSHEDCOSTMULT 0.3 //int 0-100
#define FLUSHEDTIMEMULT 1 //int 0-100
#define FLUSHEDPROB 10 // int 0-100 Chance of being on in a fantom
#define FLUSHEDPROB_IFPIRATE 20 // int 0-100 Chance of being on in a fantom // if ship.nation = pirate

In my experience though, some ships are bugged even without upgrades. Its probably a closest point thing
 
Off topic but lately, ever since i attacked and boarded some French warships off Hispaniola (I am playing Tales of Chevalier and am neutral with France) and was opened upon by the French fort there (and at Tortuga) I have been unable to approach any French fort without it opening fire, despite my having reloaded, reinitialized, changed flags, landed at many other settlements and all the while being neutral with france (-29 if i recall). To top it off, when i go to Nevis and seek to repair my relations, i can do so with the Portugese and Spanish (who are still neutral but somewhat lower) yet not with the French.

This is a rather irritating problem and i was wondering if anyone had any clue why this has happened. I am going to try boarding a French ship or two and then repairing relations
 
Have you tried flying your personal flag? That should give you your REAL relations to the nations.
 
Have you tried flying your personal flag? That should give you your REAL relations to the nations.

Tried every flag including personal and reinitializing, nothing worked.

The French ships or townguard would not attack me, only forts. However, a letter of marque obtained from the French after landing elsewhere did the trick. I think the diplomat would too, IF i managed to drop my relations low enough (which i didnt)
 
Fun fact - the only ship upgrade effect that cannot be stacked(via berthing - ie. upgrading, berthing, upgrading, berthing, upgrading, etc) is lowering closest point with stays.

Don't you think it would be a good idea, if a player got a notice after each upgrade, what was the exact effect of the upgrade, and what were the minimum and maximum effects possible? It would give a player something to do with the huge money that is so easy to get on higher levels. I just wasted 6 millions trying to get a good closest point on my Heavy Frigate.

Just to let you guys know - I'm working on the 'losing upgrades when berthing' issue, but I introduced some new berthing bugs, so I won't give it to you yet ;) .
 
I wouldn't mind the upgrade descriptions being clarified a bit; it's easy enough to replace the texts themselves.
 
In my opinion ship upgrades are too expensive - i generally reduce their cost by a factor of 10 or so in my game, although in my current game i havent used them or changed their price due to the speedy gonzales ships issues.

As for too much money - I found a solution!

Well, sort of anyway. Basically, i went into options, and under 'salary' I changed the factor to as high as it would go - 30. I also disabled looting bodies. Now, for the first time ever in the game, ive actually LOST money - from some 9 million im now at 7 million. Each month I pay anywhere from 100,000-300,000 for a ship with ~100 crew and some officers to as high as 500,000 to 600,000 for several captains, officers and large ships with ~300 crew each. That means there is actually some thought required now on how large a fleet i want to sail with and some urgency to making money (though its still easy of course). Looting is surprisingly easy to go without - its actually more enjoyable not looting bodies, as after each fight you dont run around picking things up, and dont spend nearly as much time selling things at merchants. Because looting was probably the best source of income (you could quite easily gain 50,000 to 100,000 in items and gold from looting in a single boarding), disabling looting goes a long way to balancing income. Sailing around with 4 ships of the line might now actually be a hard to support habit, whereas cost effective trade ships now make sense. Ive actually culled my list of officers in order to cut down costs - officers can demand 30,000-50,000 salaries and even more as captains!

It isnt perfect of course and unfortunately 'salary' cant be increased beyond a factor of 30. Also, with salaries so high you need to hold ~600,000-900,000 gold to prepare for the salaries at the end of the month and the 1,000,000 gold limit before crew morale begins to suffer because of 'crew jealousy' becomes incredibly irritating (wish there was a way to disable that, its an artificial restriction on how much gold you hold and easily overcome by putting gold in your cabin) - it should be at least 2,000,000 or entirely disabled.

Also, with salaries this high the nominal value of money just feels way too high overall - millions of pieces of gold being paid for ships and salaries makes the place feel like a nightmare Weimar republic inflation scenario. This has no real effect on gameplay of course except for the captain's restriction on holding money due to 'jealousy' but it just doesnt feel right when compared to gold coins in the 18th century Caribbean.

Still, changing salary to 30 imho greatly improves gameplay
 
Returning to the original topic of this thread, I think the best policy given that upgrades are not kept when berthing ships is to actually unapply the upgrades before berthing the ship. Apart from flush ship/reinforced upgrades which cannot be unapplied and are not really a major issue, the trouble with this has been that you only get a very small fraction of the price you paid back, making it highly uneconomical.

EDIT 3: After a bit of testing i think i know how to change the price you get back for your upgrades. Ive detailed it in the post below
 
EDIT 3: Ok, it seems that in order to change the price you get for your upgrades when you sell them back to the shipyard, both Shipyard.c and KB_routines.c are needed. The following seems to do the trick for me (Note - backup these files);

Go to /PROGRAM/ KB_routines.c
and find the following line from the following function;
cost = GetCostTun(_idx, _improvement)/10;
int UnApplyTun (int _idx, string _improvement)
{
int i,j;
float pertoadd;
ref char;
int time;
int cost;

time = GetTimeTun(_idx, _improvement)/10;
cost = GetCostTun(_idx, _improvement)/10;
if (time < 1) { time = 1; }

if (_idx == 0 ) { char = GetMainCharacter(); }
else { char = GetCharacter(_idx); }
switch (_improvement ) {

case "cplates":
unapplytunspeed(char,"cplates");
unapplytunturning(char,"cplates");
unapplytuninertia(char,"cplates");
break;

case "nsails":
unapplytunspeed(char,"nsails");
unapplytuninertia(char,"nsails");
unapplytunsailhp(char,"nsails");
unapplytunsailcrit(char,"nsails");
break;
case "ltopmasts":
unapplytunspeed(char,"ltopmasts");
unapplytuninertia(char,"ltopmasts");
unapplytunsailcrit(char,"ltopmasts");
break;
case "stays":
unapplytunturning(char,"stays");
unapplytuntack(char,"stays");
break;

case "bcannons":
char.ship.tune.bcannons.on = 0;
break;
case "gchasers":
char.ship.tune.gchasers.on = 0;
break;

//Kblack - It's not allowed to take out, but... just in case.
case "rhull":
unapplytunhullhp(char,"rhull");
unapplytuninertia(char,"rhull");
unapplytunupcaliber(char,"rhull");
break;

//Kblack - It's not allowed to take out, but... just in case.
case "flushed":
unapplytunspeed(char,"flushed");
unapplytunturning(char,"flushed");
unapplytunhullhp(char,"flushed");
unapplytunload(char,"flushed");
break;

}

if (time > 0) {
WaitDate("", 0, 0, time, 0, 0);
Log_SetStringToLog("You get your ship " + time + " days later.");
}
if (cost > 0) {char.Money = sti(char.Money) + cost; }
return 0;
}

This function in KB_routines is one of the functions that determines what price you get when you sell upgrades. This one seems to apply to upgrades on ships you acquire - I needed to change this after buying a ship and buying/selling upgrades on it. The function gives you one tenth of the original price you paid.

In order to change this, simply go to the line 'cost = GetCostTun(_idx, _improvement)/10' and change the '/10' and delete it for full price, or change it to whatever you desire (eg /1.25 for 80% full price). Because this only controls some occasions on which you sell upgrades, whatever value you choose you should use the same value in shipyards.c (otherwise youll get inconsistent sell prices).


Now go to /PROGRAM/INTERFACE/ Shipyards.c
and find the following line from the following function;
cost = cost / 10; // Screwface : You receive 10 % of the original price
trace("upgrade="+upgrade);
int cost = GetCostTun(cn, upgrade);
if (CheckTun(cn, upgrade))
{
UnApplyTun(cn, upgrade);
cost = cost / 10; // Screwface : You receive 10 % of the original price
if(nCurFourNum != 0) mainchar.Money = GetCharacterMoney(mainchar) + cost;
}
else
{
// Screwface It is not always the char who has upgrade applied who pay it, ex : for companions it's you
ApplyTun(cn, upgrade, 0, GetTimeTun(cn, upgrade)); // Previously the cost was decreased TWO TIMES !!!!!
mainchar.Money = GetCharacterMoney(mainchar) - cost;
}

The line 'cost = cost / 10;' seems to apply to situations where you dont buy a ship - it seems to work on my pirated ones. It does just what screwface says it does - gives you 10% of the price of the ugprade.

Simply change the /10 to exactly the same thing you did in KB_routines.c - either delete the '/10' entirely for full price, or change to eg '/1.25' for 80% price.



Youre done! Hopefully, your upgrades should now be sold for whatever price you wanted and mixing berthing and upgrades is no longer such a problem
 
You CAN disable the 1000000 limit at the bottom of PROGRAM\InternalSettings.h; set UNLIMITEDLOOT to 0. However, it should be a 1000000 ABOVE the required salary and not including the salary.
Search the PROGRAM folder for UNLIMITEDLOOT and you can probably set it to 2000000 as well. I think it's in Worldmap\DailyCrewUpdate.c .

You CAN also allow yourself to set the salary multiplier higher still. Find this code in PROGRAM\INTERFACE\option_screen.c:
Code:
	if(settingName=="SALARY_MULTIPLIER") return 30;		// LDH up from 15 - 16Apr09
 
Okey, here are a few files.

Short description:
-Fix for the badly stripped upgrades when laid up.
-Fix for the stays upgrade causing ships to sail at supersonic speeds.
-Fix for sloops(no longer can go supersonic ;)
-Player now gets a notification of how well the upgrade works compared to max possible effect.

Long description:
- in file kam_shipberthing_ship.c, lines 202-203 I call a function causing upgrades to get unapplied before berthing.
- in file kam_shipberthing_windows.c I changed a few descriptions so that now they explicitly state that upgrades get stripped when the ship gets laid up.
- in KB_routines.c I inserted 2 new functions - UnApplyTunBerth which basicly does the same as the standart UnApplyTun, but takes no time, and stripUpgradesBerth which strippes all upgrades using UnApplyTunBerth. I also inserted small pieces of code into existing applyTun functions, that log both the improvement caused by the upgrade and maximum possible improvement that was posssible.
- in AIShip.c, line 4201 I changed minimum closes point that can be gotten via stays upgrade to 0.15
- in Ships_init.c I changed some ships(I remember only sloops, but I did that quite some time ago so Im not sure if there was more) to not have lower closest point than 0.15. The file was to big, so I rared it.

I didn't include the pricing changes, because I belive the whole economy needs a rework, and we're gonna need to change it then anyway.
 

Attachments

  • kam_shipberthing_ship.c
    49.9 KB · Views: 114
  • kam_shipberthing_windows.c
    54.1 KB · Views: 119
  • AIShip.c
    194.6 KB · Views: 142
  • Ships_init.rar
    35.1 KB · Views: 110
  • KB_routines.c
    23.3 KB · Views: 142
Arrgghh! It is St. Patrick's Day here and I am already three sheets to the wind. :drunk Looking forward to corned beef, cabbage, potatoes, soda bread, and green beer. :beer

Will install these files later..... :j1
 
Thanks a LOT mate! :bow
I'd add you to the "Modders" group, but the Admin Control Panel seems to be acting up for me today. :facepalm

If you come up with values that work well for game-balancing, please let me know and I'll put them in the next modpack update. :doff
 
Okey, here are a few files.

Short description:
-Fix for the badly stripped upgrades when laid up.
-Fix for the stays upgrade causing ships to sail at supersonic speeds.
-Fix for sloops(no longer can go supersonic ;)
-Player now gets a notification of how well the upgrade works compared to max possible effect.

Long description:
- in file kam_shipberthing_ship.c, lines 202-203 I call a function causing upgrades to get unapplied before berthing.
- in file kam_shipberthing_windows.c I changed a few descriptions so that now they explicitly state that upgrades get stripped when the ship gets laid up.
- in KB_routines.c I inserted 2 new functions - UnApplyTunBerth which basicly does the same as the standart UnApplyTun, but takes no time, and stripUpgradesBerth which strippes all upgrades using UnApplyTunBerth. I also inserted small pieces of code into existing applyTun functions, that log both the improvement caused by the upgrade and maximum possible improvement that was posssible.
- in AIShip.c, line 4201 I changed minimum closes point that can be gotten via stays upgrade to 0.15
- in Ships_init.c I changed some ships(I remember only sloops, but I did that quite some time ago so Im not sure if there was more) to not have lower closest point than 0.15. The file was to big, so I rared it.

I didn't include the pricing changes, because I belive the whole economy needs a rework, and we're gonna need to change it then anyway.


:shock: :woot :dance

One question - do you get a refund for the upgrades?
 
I know it's from last month, but, from what I remember, this forum tends to travel rather slowly, anyways...the reason that a square rigger will not make best speed at 180 degrees to the wind is due to the fact that the mizzen sails will tend to occlude the mainsails, which will, in turn, occlude the foresails. This results in the ship only effectively using 1/3 of her full sail area, whereas, at about 10-20 degrees astern, the wind can fill all sails equally, providing maximum motive force.

Also, to address another issue which has popped up here, the reason it's impractical to re-value all the ships to their "correct" prices is that the economly needs a major overhaul...I bet you can still smuggle rum to Dutch islands?...(try it, but don't blame me for the inevitable mutininous outcome...) I've actually devoted a surprisingly large quantity of time to considering how one could re-work the entire economy but, having absolutely no idea of how the technical bits of a computer work, have been unable to graft any of the ideas into an implementable format. If anyone would be willing to undertake the coding side of such a project, I would be happy to furnish them with my inner ramblings on the subject...
 
Pieter Boelen said:
HA! I managed it after all, so welcome to the Modders! :woot

Thank you :dance

irR4tiOn4L said:
One question - do you get a refund for the upgrades?

You get some money back, just as if you unupgraded in a shipyard - 10% of what you paid to upgrade. The cargo that was on the ship get's sold at the store on normal terms afterall, so I figured upgrades should get stripped at normal terms as well.

Derkylos said:
If anyone would be willing to undertake the coding side of such a project, I would be happy to furnish them with my inner ramblings on the subject...

Then let's create a topic about it. I may not have much free time, and I have a few things I'd like to make before this, but I'd like to get to it sometime, and we should gather our thoughts on the subject nonetheless.
 
Back
Top