• 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 Need help for adding new perks from other Sea Dogs games

Rolee9309

Powder Monkey
Hi guys!

Long time no see, I have a pretty hectic life - again, and I'm lost in improving the base game - again. There is probably a thread about some of them (probably I too did one, I can't remember), so sorry in advance if that's the case! And I did not forgot to create separate skill trees, but first I have to add all of the new required perks.

So, I try to add 3 new perks from other games (TEHO, COAS, Caribbean tales), they have cool perks which I added to the base game already, but these 3 I just can't get to work (long time ago when I first did, 2 of them worked, but my disk completely died so I had to restart from nothing years later...):

- Pack rat: increases the cargo capacity by 15%. I have no idea how to do this, by simply copypasting from other games' files does not work. Has icon, description, implemented into the perk system, but just does not work.
- Builder: decreases the amount of materials to repair the ship out of battle in the sea. So if you needed 10 planks to get 1% of your ship to repair, now it needs let's say 8. I had this, but I completely forgot how to do it again. I don't remember where to put it, and what to code to work. Other game (COAS - Combined Mod V3.2) has different commands so the idea is there, and I did that, but now nothing...
- Windcatcher: increases the sail roll up and down speed (I got this), but the acceleration/deacceleration of ship by 15% just does not work. I found the code in the game Caribbean tales CharacterUtilite file, but this does not work.

If some of the helpful, kind modders/coders would help me, I would be very happy and thankful! Now I am learning to code officially too, I will probably understand better than... 4-5 years ago, when I just copypasted and trial and error'd most of the things (somehow they worked, but now? NOOOOPE...). :oops:
 
Soo, some interesthings: I made the Builder perk a T3 perk, which means it needs 2 perks to unlock: light repair and quick repair. With those, and with the crew being at max, and being heroic, and repair skill maxed out at 10, to get 20% decreased material cost when repairing the ship at the sea, I got this equation, to somewhat get to -20% mats (I have it in the BattleInterface.c file):

if(CheckCharacterPerk(chref, "Builder"))
{
fGoodsQ = fGoodsQ + fGoodsQ / 50;
}

return fGoodsQ;

Such a weird number, but hey, it works! Test environment was: I checked what happens after 4 days of sailing open world (game starts at 16th of april, I sailed till 20th - to be exact, I used the worldmap's music to measure the time spent). In that 4 days, the crew used 33 planks. Now with this wonky numbered perk, it is 27, which is roughly a 20% material decrease.
Might try it without heroic crew and 10 at repair to see if the math is still correct.
 
That is some very strange math. I had a quick look and you can probably easily do it in `RemoveRepairGoods` and use something like this:

Code:
if(CheckCharacterPerk(chref, "Builder"))
{
    fGoodsQ -= 0.80 * matQ;
}
else {
    fGoodsQ -= matQ;
}
 
Thanks, I will check it. I too tought what a messy calculation is this, because (I'm going to be honest: ) I firstly just copypasted the code, which was a very simple fGoodsQ = fGoodsQ * 0.9, which meant 10% less materials. But I ended up losing almost triple the amount of planks used rather than saving 10%.
 
Code:
void RemoveRepairGoods(bool bIsHull, ref chref, float matQ)
{
    int nGoodsQ = 0;
    float fGoodsQ = GetRepairGoods(bIsHull,chref);

   [B] if(CheckCharacterPerk(chref, "Builder"))
    {
    matQ -= matQ * 0.2;
    }[/B]

    if( bIsHull )
    {
      
        if(fGoodsQ<=matQ)    { DeleteAttribute(chref,"RepairMaterials.forHull"); }
        else
        {
            fGoodsQ -= matQ;
            nGoodsQ = makeint(fGoodsQ);
            chref.RepairMaterials.forHull = fGoodsQ - nGoodsQ;
        }
        SetCharacterGoods(chref,GOOD_PLANKS,nGoodsQ);
    }
    else
    {
        if(fGoodsQ<=matQ)    { DeleteAttribute(chref,"RepairMaterials.forSails"); }
        else
        {
            fGoodsQ -= matQ;
            nGoodsQ = makeint(fGoodsQ);
            chref.RepairMaterials.forSails = fGoodsQ - nGoodsQ;
        }
        SetCharacterGoods(chref,GOOD_SAILCLOTH,nGoodsQ);
    }


This works too, looks more normal than my first attempt. But with the code you provided it actually uses more. Like almost double (39 planks remained vs. 67 by default). Seems like the -= and the * 0.2 makes it cost 20% less, because 61 ( the result of your code in planks used) vs. 33 (mine) is 28. And the 28 is roughly 80% of the 33. So by this it seems if we multiply it with 0.8, it actually uses 80% more. But if only multiple with 0.2 it uses 20% LESS. Weird... I will tinker with it.
 
Back
Top