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

Build12:Adjusting amount of plundered gold, balancing issues

evil_parrot

Landlubber
Hey guys,
after installing build 12.1 a few days ago this mod delivered fun and addiction. Playing on swashbuckler level seems to be quite challenging, BUT there is one point when the game becomes too easy: once you are able to capture bigger ships (say super frigates or the 44 gun "lineship") you get insane amounts of gold from plundering, about 1 million for a lineship in at least one case.

a) If a modder could give me brief tutorial how to change the corresponding values (for plundered gold) i would be grateful. Is it possible to have different values for the ship classes? Pure military ships like frigates should not give much gold or cargo.
B) Also i would like to know how to implement a "level cap" for the player and his officers. The idea is to prevent the player and his officers from reaching high levels (20+), because its simply no fun with all skills maxed out.
c) The repair costs are too low for my taste. If a given ship is almost a wreck the repair cost should be more than 2/3 of what a new ship would cost. Where can this be modified?
d) Is there a way to determine the amount of plundered goods (on a ship class basis)?

Anyway a great mod, thanks to all the modders involved!
 
IMHO it is anyway to easy to amass money in PotC, but that much for a ship is kind of a spoiler. Though IIRC we didn't have that problem before B12, right ? Maybe some change in the shipsystem, like Nathan Kell's PRS3 system, has messed up the old calculation. FAIK Nathan made the code for that as well, as usual in a very sophisticated way. Each shipcaptain has an attribute .ShipMoney, which is calculated upon creation of the character in SEA_AIAIFantom.c:


// add money
// `04-09`-22 add SHIPMONEY_MULT
switch (rFantom.FantomType)
{
case "trade":
rFantom.ShipMoney = makeint(SHIPMONEY_MULT * (cap * makefloat(30 + rand(20) + rand(20)) * (rscale/2.0 + rand(rscale))/40.0 + (rand(10)+5.0)/30.0));
return;
break;
case "war":
rFantom.ShipMoney = makeint(SHIPMONEY_MULT * (weight * makefloat(40 + rand(10) + rand(10)) * (rscale/2.0 + rand(rscale))/20.0 + (rand(10)+5.0)/30.0));
return;
break;
case "pirate":
rFantom.ShipMoney = makeint(SHIPMONEY_MULT * (weight * (5.0 + (rand(5)+1.0) * (rand(5)+1.0)) * (rscale/2.0 + rand(rscale))/20.0 + (rand(10)+5.0)/15.0));
return;
break;
}


He took shiptype and class into account, so I don't know why we suddenly have so ridiculously high amounts of money. There is even a scalar in buildsettings.h which should reduce the shipmoney, #define SHIPMONEY_MULT



This line in SEA_AIAIShip.c finally gives the money to the successful boarder:

if(iKillStatus == KILL_BY_ABORDAGE) { AddMoneyToCharacter(rKillerCharacter, sti(rDead.ShipMoney));
Log_SetStringToLog("Gained " + rDead.ShipMoney + " gold!"); } // NK


So if nothing before has stopped the flood of money one could cap it here, by reducing shipmoney in a line directly above:

rDead.ShipMoney = sti(rDead.ShipMoney) * 0.01;
if(iKillStatus == KILL_BY_ABORDAGE) { AddMoneyToCharacter(rKillerCharacter, sti(rDead.ShipMoney));


Or one could apply the buildsettings scalar once again:

rDead.ShipMoney = sti(rDead.ShipMoney) * SHIPMONEY_MULT;


Or a completely new formula, e.g. based on cargocapacity:

rDead.ShipMoney = rand(rDead.Ship.Capacity * 10)


If you can sketch a formula I can put it in code <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
thanks for your insights couchcaptaincharles, but this code magic is giving a `programmer-landlubber` a headache.
however i copied this line in the SEA_AIAIShip.c , as you suggested:

rDead.ShipMoney = sti(rDead.ShipMoney) * 0.01;

and it worked, thank you! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />

the thing is, even by cutting down the amount of plundered gold by 1/100 you still get too much money from selling the hand weapons. where can this be modified?
do you know how to reduce the amount of goods that enemy ships carry? its not likely that any merchant uses 100% of its cargo capacity every time.
 
turns out that
rDead.ShipMoney = sti(rDead.ShipMoney) * 0.01;
somehow works for smaller ships, but the 44 gun lineship (the biggest ship i was able to successfully board yet) still gives about 1 million gold <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mad.gif" style="vertical-align:middle" emoid=":c" border="0" alt="mad.gif" />
 
Weird <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_eek.gif" style="vertical-align:middle" emoid=":shock:" border="0" alt="icon_eek.gif" /> Maybe someone created a special boarding premium for such ships, not connected with the normal shipmoney code.

Can you remember if there was any screenmessage related to the gold ? That would make searching for that code easier.
 
You could try to check that if you outcomment the line giving the shipmoney to you, i.e. put two "comment" slashes "//" in fromt of it, like this:

// if(iKillStatus == KILL_BY_ABORDAGE) { AddMoneyToCharacter(rKillerCharacter, sti(rDead.ShipMoney));
// Log_SetStringToLog("Gained " + rDead.ShipMoney + " gold!"); } // NK

That would prevent the program from executing those lines. If you still get your millions then we are on the wrong track here, and some other routine awards millions for big ships.


BTW, there is another line awarding shipmoney to you if you TAKE a ship, in the function "void ShipTaken" further down in AIShip.c:


AddMoneyToCharacter(rKillerCharacter, sti(rDead.ShipMoney)); // NK

So one must reduce rDead.ShipMoney there as well.



BTW2, if you want to get less money for plundered swords you could switch the swordplundering off in buildsettings.h:

#define LOOTDEAD_ON 0

or reduce the prices of swords in itemsinitItems.c .



BTW3, would it be a good idea to make swords `non-tradeable`? So that you had to FIGHT better armed enemies in order to get better swords cause you couldn't just buy at the next merchant?
 
Not a bad idea, the question is, can you still SELL swords if they´re not tradeable (skiptrade = true)? With ships, there´s the canBuy function, so you can´t buy but still sell them, but swords, or items in general, only have the skiptrade switch, as far as I know.
 
I think the way it works with personal items is, you can make something not buyable in stores, only findable in chests or other random places, but still sellable so long as you define a price... anything with a price of 0 you cannot sell, and I'm not sure if you can even exchange it with officers.

With the swords only from killin', trouble is that my enemies are almost always given such crappy swords... almost always worse than mine, so I'd never get a better one.
 
thanks for your suggestions,
i decreased the shipmoney_multiplier from 0.01 to 0.001 and finally it works: after successfully boarding a 44 and 70 gun lineship my mates looted `50000-100000` gold pieces.

buildsettings.h
#define SHIPMONEY_MULT 0.001 // multiplier to how much money you get on boarding

<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
50,000 te 100,000 gold <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> ye are an evil parrot mate :par <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.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" />
 
<!--`QuoteBegin-evil_parrot`+--><div class='quotetop'>QUOTE(evil_parrot)</div><div class='quotemain'><!--QuoteEBegin-->thanks for your suggestions,
i decreased the shipmoney_multiplier from 0.01 to 0.001 and finally it works: after successfully boarding a 44 and 70 gun lineship my mates looted `50000-100000` gold pieces.[/quote]
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" />
I did that with my game some time ago and found that at the start it makes for a real challenge, but as you go on to higher levels, you still get ever increasing amounts of money, ... too much money!

Another example, look what happens when you stop the rapists.
If you are on level 5, you get 500. If on level16, you get 1600.
By level 30 ... you guessed it ... 3000!

Your level must be part of the formula somewhere!
If that could be disabled <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bookish.gif" style="vertical-align:middle" emoid=":mm" border="0" alt="bookish.gif" />
 
I hate when she gives me money anyway, because the only reason I ever save her sorry ass againa nd again and again is when I need the `rep-up`. When I go through all that trouble and she just gives me some money, when I already have like a billion dollars.. well, it takes a bit of `self-restraint` not to stab her.
 
One question: Where´s the rDead.shipmoney defined? I mean, there´s nothing like a definition in the AIShips.c, and I suppose it´s some sort of a function depending on shipclass, shiptye (War, Trade or Pirate) and a random variable.
 
.shipmoney is an attribute, a kind of subvariable that belongs to some object. Think of it as a kind of tag that is being stuck to some character or location, and something is noted on it. Attributes are being defined simply by assigning a value to them: pchar.money = 1000

When a shipcaptain is being created in SEA_AIAIFantom.c the character has the variablename "rFantom". This section sticks the tag ".shipmoney" to him, calculates a value for that and "notes" it.

<!--`QuoteBegin-CouchcaptainCharles`+--><div class='quotetop'>QUOTE(CouchcaptainCharles)</div><div class='quotemain'><!--QuoteEBegin--> Each shipcaptain has an attribute .ShipMoney, which is calculated upon creation of the character in SEA_AIAIFantom.c:


// add money
// `04-09`-22 add SHIPMONEY_MULT
switch (rFantom.FantomType)
{
 case "trade":
  rFantom.ShipMoney = makeint(SHIPMONEY_MULT * (cap * makefloat(30 + rand(20) + rand(20)) * (rscale/2.0 + rand(rscale))/40.0 + (rand(10)+5.0)/30.0));
  return;
 break;
[/quote]

The ship captain carries this tag with him all the time, until he may be captured by you. The code for that event is in SEA_AIAIShip.c, and her the unfortunate captured captain has the variablename "rDead". The program looks at the tag/attribute ".shipmoney" of him, which would be rDead.shipmoney, and gives you the amount noted on it.
 
Cargogoods are being assigned to random ships by the function Fantom_SetGoods in AIFantom.c . If you want to reduce it try first to outcomment this section

//Fill ship up to >= 90% full.
float rndscl = 0.3 * frnd();
if(rFantom.FantomType == "trade") {
while(GetCargoFreeSpace(rFantom) > GetCargoMaxSpace(rFantom) * rndscl && GetCargoFreeSpace(rFantom) > 4) {
Fantom_SetCharacterGoods(rFantom, iStart + rand(GOODS_QUANTITY - iStart - 1), iMultiply * rand(iRandMultiply * 3));

which seems to make tradeships 90% full.

If that's still too much it might help to reduce one of the factors in this line

iMultiply = (rand(10)+10) * (rand(iShipClass) + 2); // `Stone-D` : They ARE traders after all!




About sailcloth consumption for repair I am not sure. There is a function procActionRepair in BattleInterfaceutils.c , and this section seems to consume sailcloth:


nMaterialS -= nMatDeltaS;
goodsName = Goods[GOOD_SAILCLOTH].Name;
chref.Ship.Cargo.Goods.(goodsName) = nMaterialS;
chref.Ship.Cargo.Load = sti(chref.Ship.Cargo.Load) + sti(Goods[GOOD_SAILCLOTH].Weight)*nMatDeltaS;


So putting a line reducing the consumption nMatDeltaS above that might help:


nMatDeltaS = nMatDeltaS * 0.5 ;
nMaterialS -= nMatDeltaS;
goodsName = Goods[GOOD_SAILCLOTH].Name;
 
(Another idea raised a while ago but that went unfulfilled, was that perishable goods would degrade in quality after a while, thus giving all the more incentive to ship it quickly instead of letting it sit in your hold. That and blades losing their quality with use or time, thus needing "sharpened" to restore them. I wouldn't know how to begin with either but I wanted to bring the two ideas back up while we're thinking.)
 
<!--`QuoteBegin-CouchcaptainCharles`+--><div class='quotetop'>QUOTE(CouchcaptainCharles)</div><div class='quotemain'><!--QuoteEBegin-->Cargogoods are being assigned to random ships by the function Fantom_SetGoods in AIFantom.c . If you want to reduce it try first to outcomment this section

//Fill ship up to >= 90% full.
float rndscl = 0.3 * frnd();
if(rFantom.FantomType == "trade") {
 while(GetCargoFreeSpace(rFantom) > GetCargoMaxSpace(rFantom) * rndscl && GetCargoFreeSpace(rFantom) > 4) {
  Fantom_SetCharacterGoods(rFantom, iStart + rand(GOODS_QUANTITY - iStart - 1), iMultiply * rand(iRandMultiply * 3));

which seems to make tradeships 90% full.

If that's still too much it might help to reduce one of the factors in this line

  iMultiply = (rand(10)+10) * (rand(iShipClass) + 2); // `Stone-D` : They ARE traders after all![/quote]

Well i dont have any programming or mathematical background , please explain what
(rand(10)+10) and (rand(iShipClass) + 2) means. Sorry for asking such "trivial" questions, i am willing to learn, but just like breewing a good beer, it takes time. <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" />
If a ship is >= 30% full, what would the formula look like? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bookish.gif" style="vertical-align:middle" emoid=":mm" border="0" alt="bookish.gif" />
 
rand() means a function that selects a random number (an integer or a floating one? I don´t know) from a certain range, so rand(10) is a function that each time it is run produces a randomly selected number between 0 and 10. The term iShipClass refers to the seven shipclasses, so, instead of writing rand(7) it´s the number of possible shipclasses, in case somone might add more. So, this line<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->(rand(10)+10)<!--QuoteEnd--></div><!--QuoteEEnd-->
means nothing but the program selects a random number between zero and ten and then adds ten to this number. I hope that helped, because that´s as far as I´m into the code so far.

By the way, Evil_parrot, what difficulty level are you playing on? I´m asking because I don´t have that problem with getting immense amounts of gold from warships playing on Journeyman. What I DO find odd, however, is that the Man o War seems to be used in random encounters more often than the Battleship ( I outcommented those Black Pearl based warships already), though both are the same class (1). I wonder why´s that.

And, CCC, thanks a bunch, I´ll take a look into it.
 
thanks grimmelshausen, so lets assume (rand(10)+10) = 20 and (rand(ishipclass) + 2) = 7, then (rand(10)+10) * (rand(iShipClass) + 2) = 140.
how does imultiply = 140 lead to ships beeing >= 90% full? the function Fantom_SetGoods is way to complicated for me. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mad.gif" style="vertical-align:middle" emoid=":c" border="0" alt="mad.gif" />

i am currently playing on swashbuckler and didnt notice more man o war than battleships - because i renamed any ship > frigate to "ship of the line" <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
you could assign these ship types to different rating numbers, which would be historically correct. the battleship (70 guns) would be a 3rd rate ship and the man o war (100 gun) a first rate ship. when the new 74 gun ship of the line is finished, i ll disable the man o war. its just too powerful.
 
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->how does imultiply = 140 lead to ships beeing >= 90% full? the function Fantom_SetGoods is way to complicated for me.<!--QuoteEnd--></div><!--QuoteEEnd-->
Dito.

<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->i am currently playing on swashbuckler and didnt notice more man o war than battleships - because i renamed any ship > frigate to "ship of the line"  <!--QuoteEnd--></div><!--QuoteEEnd-->
Well, that´s a way to go, but I was reffering to the shipmodel "Man of War", the `hundred-gun` vessel. As a matter of fact, I like the Man of War as an opponent because it´s a challenge, but I´d rather see more Battleships, I like their looks. They´re much more the big warship you´re likely to come across in the Caribbean in the 1650s (I´ve reset the starting year to 1649, for my character). If nothing else can help, I´ll have to disable the Man of War as well.
 
Back
Top