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

[HELP] Quick-repair - Light repair - Broken?

surg23

Landlubber
Hey guys,


I recently distributed some ship perks into Light repair and quick repair, but have found both to be quite useless, totally in fact!


Despite the misleading Perk descriptions, i find both repair methods to be disfunctional at the best of times, they only show up when they want to, for instance my companion ship has lost the same hp and sails as my ship yet only he has a repair option, where i have to bank myself into a reef until my sails and HP are below 60% just for Quick repair to show up .... when i do this all that happens is my sails get maybe 10% repaired, the hull doesen't repair at all despite having excessive amounts of cloth and Planks.

Also i tested this rigorously with a competent carpenter, executing Quick repair at approximately 60% or less HP-Sails only repairs either the sails or the hull (not both) and only 10%, while doing so it only uses 20 units of material out of a much larger supply.

Adding to this problem is the issue with Light repair, since i unlocked Quick repair, the option for Light repair never shows anymore, regardless of the ships integrity.


I am playing version 1.3 with no mods or anything installed, but i have located the source files that govern the repairs, which i guess are Utils.txt in which i find the following:


//======================================================
// Fast repair
//======================================================
{
float ftmp1,ftmp2;
int nMaterialH = GetCargoGoods(chref,GOOD_PLANKS);
int nMaterialS = GetCargoGoods(chref,GOOD_SAILCLOTH);
int nMatDeltaH = 0;
int nMatDeltaS = 0;
string goodsName;
if(hpp < InstantRepairRATE && nMaterialH>0) // boal 23.01.2004
{
fRepairH = InstantRepairRATE - hpp; // boal 23.01.2004
if(fRepairH>BI_FAST_REPAIR_PERCENT) {fRepairH=BI_FAST_REPAIR_PERCENT;}
ftmp1 = GetHullPPP(chref);
ftmp2 = fMaterialH + ftmp1*fRepairH;
if(ftmp2>nMaterialH)
{
fRepairH = (nMaterialH-fMaterialH)/ftmp1;
nMatDeltaH = nMaterialH;
fMaterialH = 0.0;
}
else
{
if(ftmp2>1.0)
{
nMatDeltaH = makeint(ftmp2);
fMaterialH = ftmp2 - nMatDeltaH;
}
}
hpp += ProcessHullRepair(chref,fRepairH);
}
if(spp < InstantRepairRATE && nMaterialS>0) // boal 23.01.2004
{
fRepairS = InstantRepairRATE -spp; // boal 23.01.2004
if(fRepairS>BI_FAST_REPAIR_PERCENT) {fRepairS=BI_FAST_REPAIR_PERCENT;}
ftmp1 = GetSailSPP(chref);
ftmp2 = fMaterialS + ftmp1*fRepairS;
if(ftmp2>nMaterialS) { fRepairS = (nMaterialS-fMaterialS)/ftmp1; }
fRepairS = ProcessSailRepair(chref,fRepairS);
if(fRepairS<=0.0)
{
nMatDeltaS = 0;
fMaterialS = 0.0;
nMaterialS = 0;
}
else
{
ftmp2 = fMaterialS + ftmp1*fRepairS;
if(ftmp2>1.0)
{
nMatDeltaS = makeint(ftmp2);
fMaterialS = ftmp2 - nMatDeltaS;
}
}
}
if(nMatDeltaH>0)
{
nMaterialH -= nMatDeltaH;
goodsName = Goods[GOOD_PLANKS].Name;
chref.Ship.Cargo.Goods.(goodsName) = nMaterialH;
chref.Ship.Cargo.Load = sti(chref.Ship.Cargo.Load) - sti(Goods[GOOD_PLANKS].Weight)*nMatDeltaH;
}
if(nMatDeltaS>0)
{
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;
}

if(hpp < InstantRepairRATE && nMaterialH>0) // boal 23.01.2004
{ PostEvent("evntActionRepair",BI_FAST_REPAIR_PERIOD,"llff",chrIdx,1, fMaterialH,fMaterialS);
}
else
{ if(spp < InstantRepairRATE && nMaterialS>0) // boal 23.01.2004
{ PostEvent("evntActionRepair",BI_FAST_REPAIR_PERIOD,"llff",chrIdx,1, fMaterialH,fMaterialS);
}
else
{


So can anyone help me with adjusting those values so i can use Quick/Light repair regardless of my ships condition, that would be great.
 
The light repair option wont appear until you are about to sink, anotherwords, your hull is only at 5% or so remaining strength. That's why you're not seeing it often. Also I agree on the huge quantities, but do not see that as wholly unrealistic. If its a small ship, you should see more significant repairs.

Make sure to look at your ships HP before and after the repairs. If its a large ship, your men are not going to be able to do much - which is realistic, especially if you are in combat, or your crew is small. All these things are factors in how the repair behaviors work.

MK
 
The light repair option wont appear until you are about to sink, anotherwords, your hull is only at 5% or so remaining strength. That's why you're not seeing it often. Also I agree on the huge quantities, but do not see that as wholly unrealistic. If its a small ship, you should see more significant repairs.

Make sure to look at your ships HP before and after the repairs. If its a large ship, your men are not going to be able to do much - which is realistic, especially if you are in combat, or your crew is small. All these things are factors in how the repair behaviors work.

MK


Hi MK,

I soon realized that was the problem, which frankly is a waste of Perks, as i have never been below 50% HP in all the 90 hours of play time. At first i thought it would be handy, purely for the purpose of repairing sails, as when they get slightly damaged it impacts ship speed a lot.

Personally i don't feel that repairing 10% sails (even in battle) to be unrealistic, traditionally on-the-fly repairs were common practice for crews, plugging holes, patching sails etc .... i guess i don't need to justify this to you, but at any rate would it be possible to mod that file to allow a 10-15% sail repair on a 30 minute cool down ?

This would be awesome for my companion ship, who always shoots his front sails out in battle and a big time saver for me when chasing down those annoying kiting Tartanes.


Thanks for responding and happy gaming :)
 
Why chase down Tartanes, you big bully. :razz


Lol, well i have little choice in the matter, a Pirate squadron engages me consisting of 1 measly Tartane or Sloop which will then proceed to fire on me and sail away (repeatedly) which is what i call "Kiting" ... which is more of a minor inconvenience since my Corvette's max speed is 23 knots, but an inconvenience none the less.

I usually let all ships go free after robbery. with the exception of those Kiting douche-bags, which i keep in my cargo hold for regular beatings. :whipa
 
Ah, maybe you should let them go so they can explain to anyone looking to attack ships to only attack should they have a good chance of actually surviving because if not they will be held in the hold and beaten on a regular basis, and even worse when a ship starts (as you put it) kiting and courses you to give chase to her, then the beatings are far worse due to the anger of having to change course.

Back to the question, it should be possible to increase the level of repairs done but i have no idea where to look because i haven't been looking in any files for a long time now i need a few day's to get back to knowing where to look for things. I would expect a file in sea_ai to have a file or two in that might need looking into and a file or two in scripts and maybe interface will have something, i know it has a folder called perks but i don't think either of the files are the core files for changing things such as required planks, sail cloth and repair rates etc.
 
That sounds like a plan, i will help search for related files when i get home ... running late for work arrghh!
 
9 hours later ....


Hey, so i had a go at decrypting the language used in Utils.txt which proved more or less fruitless. But all that really needs to be changed is the value that tells the repair function, at what percentage of ship integrity it can be executed.

So far i have seen no values stating a 65% value, which is the Quick repair's maximum magnitude.

If i am reading it correctly, the repair calculation is referencing multiple files and i can only have a guess which ones they are, as i have no experience with modding at all.

In Utils i find this:

if(hpp < InstantRepairRATE && nMaterialH>0) // boal 23.01.2004

Which i think translates into:

If ship HP = the quick repair health status needed for execution & and has material for repair - then Boal 23.01.2004 (The Boal value might be the value we are looking for, but i have no idea what it means)

This calculation repeats but for the Sail HP:

if(spp < InstantRepairRATE && nMaterialS>0) // boal 23.01.2004 (which is essentially the same Boal value)


Further down i find:


if(hpp < InstantRepairRATE && nMaterialH>0) // boal 23.01.2004
{ PostEvent("evntActionRepair",BI_FAST_REPAIR_PERIOD,"llff",chrIdx,1, fMaterialH,fMaterialS);
}
else
{ if(spp < InstantRepairRATE && nMaterialS>0) // boal 23.01.2004
{ PostEvent("evntActionRepair",BI_FAST_REPAIR_PERIOD,"llff",chrIdx,1, fMaterialH,fMaterialS);
}
else


These lines are definitely referencing another file to get the value of Quick repair, though i cannot find which one. I had a poke around in the Boal files but saw nothing relative, at any rate i will keep looking!
 
"// boal 23.01.2004" is a comment. Everything after a // or between /* and */ is a comment:

Code:
foo = bar + baz;      // This is a comment, to the left it is code

/*
This is a comment too
*/

If you are searching for InstantRepairRATE, it is in Program\_mod_on_off.h:

Code:
#define InstantRepairRATE       65.0

BI_FAST_REPAIR_PERCENT, on the other hand, is in Program\battle_interface\utils.c:

Code:
#define BI_FAST_REPAIR_PERCENT	5.0

Cheers.
buho (A).
 
Lol, hey Buho


Looks like i was way off the mark with my half-ass decrypting haha!


Great work in finding those values, so if i was to modify the InstantRepairRATE to 100, and set BI_FAST_REPAIR_PERCENT to 10, would that give me a 10% repair even if ship HP = 99% ....... blarghhh this is confusing, let me get back to this when i am fresh in the head.



Thank you kindly for helping me with this. :onya
 
Thats great find bud, any chance you know where the amount of planks and sail cloth is used per % of repair is located?

If that can be changed so not so much meterial is needed then this will fix the bug coursed by the increased ships_hull hp and sail hp value's been increased. I expect the perks to play a big part in how much meterial is used as will the repair skill of your character, so finding a working balance is not going to be as easy as it sounds and will be a case of trial and error till its more balanced. But if work on improving the repair rate/meterial used per % of repair then that would be great and a step in the right direction. :yes
 
@Rascal:

Can't say for sure just now, apparently the function is calling itself recursively. Without actually calling it to do some tracing I'm a little confused.

But I think that changing "InstantRepairRATE" is enough, IMO the function is calling itself again for 5% repair steps till the ship is repaired or there is no more materials. No need to change "BI_FAST_REPAIR_PERCENT". The recursive call is so convoluted that probably Akella made it in little steps for a good reason.

@Luke:

For the daily repair the code is in Program\battle_interface\BattleInterface.c, ProcessDayRepair().

For the perk it is in Program\battle_interface\utils.c; procActionRepair().

The basic functions, which calculate the cost in materials for a 1% repair are GetSailSPP and GetHullPPP in Program\characters\CharacterUtilite.c.

For sails, a 1% repair costs (8 - ship_class) sailcloths: 30% for a 3th rate is like 150 sailcloths. Not sure it is totally unreasonable.

No idea about how the masts plays in the sailpoints (sailpoints go down when a mast go down and masts can't be repaired at sea), so I'm not sure about what a "reasonable repair" is. May be 30% is reasonable, and 150 sailcloths is not so a big number. May be "reasonable" is 70% and 350 sailcloths is obviously crazy.

I don't think the cost in materials is related to the change made in the sailpoints, all the calculations appear to be based on percents, not in points.

As a side note, we still have that freaking bug in the sails repair process.

Cheers.
buho (A).
 
@Rascal:

Can't say for sure just now, apparently the function is calling itself recursively. Without actually calling it to do some tracing I'm a little confused.

But I think that changing "InstantRepairRATE" is enough, IMO the function is calling itself again for 5% repair steps till the ship is repaired or there is no more materials. No need to change "BI_FAST_REPAIR_PERCENT". The recursive call is so convoluted that probably Akella made it in little steps for a good reason.

Cheers.
buho (A).


Hey,


Yeah, you are definitely right about the repair going in intervals, but what i find odd is even though the BI percentage is set to 5.0, it never restores 5% per tick, conceivably it could but it would need a fraction of a plank which is quite impossible.


Some tests i ran:

22 Sail cloth + 22 planks - Result : 4.4% sails repaired - No hull repair (even though planks were consumed)?

23 Planks only - Result : 4.9% Hull repaired - (this is the closest i could get to a 5% repair interval, anything over 23 units gets an extra repair cycle, i think)
24 Planks only - Result : 5.1% Hull - 2 cycles
26 Planks only - Result : 5.5% Hull - 2 cycles
27 Planks only - Result : 5.7% Hull - 2 cycles


Kind of hard to keep track of the repair intervals, as even if press F2 to get a reading of the first tick, Quick repair is still going in the background and watching the HP by eye is almost impossible if the 2nd cycle only restores a fraction of HP, but if i can conclude anything it is there is no exact 5% repair percentage, as the BI value would have us believe.


Needs further testing, after i blow up some more pirates hehe.
 
Back
Top