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

Included in Build Rebalanced Ship Upgrade Costs

Mere_Mortal

Free Like a Radical
Storm Modder
Is it just me or are the ship upgrades way overpriced? Some of them are costing twice as much as the ship is worth, which is silly. Others are completely negligible prices, like 5-10% the value of the ship. There doesn’t seem to be any logic to the values, some appear somewhat exponential. I think this could do with looking at, but even if it is not changed for the mod I would very much like to do so for my own pleasure. Where do I need to look?
 
Look at KB_routines.c . There is plenty of logic to it, but I'm not sure if the balancing is quite right.
 
Ah, that’s what I didn’t notice before. I have seen the multipliers, and for starters I’ll see what sort of prices are returned if I remove them completely. I was thinking more along the lines of dividing the cost by ship class (or take 10 and deduct the class, then multiply), so that a class one will cost more even if it has the same hull/sails as a class two.
 
I think this will work really well for me. The prices I believe are more appropriate and the code is much tidier as well.
I’ve tagged the title as I’d quite like to see it put into place. :diomed

Code:
int GetCostTun(int _idx, string _improvement, float _priceType)
{
   ref ShipRef = GetShipByType(GetCharacterShipType(GetCharacter(_idx)))

   int ship_price      = ShipRef.price
   int ship_strength   = ShipRef.hp
   int ship_weight     = ShipRef.weight
   int ship_cannons   = ShipRef.cannonsquantity

   int modifier = GetCharPriceMod(GetMainCharacter(),_priceType,true,true)

   switch (_improvement) {
     case "rhull":     // RHCOSTMULT
       return makeint(modifier * ship_strength * 15)
     break
     case "cplates":     // CPCOSTMULT
       return makeint(modifier * ship_weight * 3)
     break
     case "flushed":     // FLUSHEDCOSTMULT
       return makeint(modifier * ship_weight * 5)
     break
     case "nsails":     // NSCOSTMULT
       return makeint(modifier * ship_price / 2.25)
     break
     case "ltopmasts":   // TMCOSTMULT
       return makeint(modifier * ship_price / 2.25)
     break
     case "stays":     // SSCOSTMULT
       return makeint(modifier * ship_price / 2.25)
     break
     case "bcannons":   // BCCOSTMULT
       return makeint(modifier * ship_cannons * 2000)
     break
     case "gchasers":   // GCCOSTMULT
       return makeint(modifier * ship_cannons * 1750)
     break
   }

   return 0
}
 
Last edited:
Cool! Post it in the New Stuff thread to make sure it doesn't get forgotten. :doff

You may want to reinstate the use of those #defines though.
 
Cool! Post it in the New Stuff thread to make sure it doesn't get forgotten. :doff

You may want to reinstate the use of those #defines though.
I intend to, it’s just easier to work in one file until I can balance it properly. I think the medium-class ships could be a little cheap, not sure. My Sloop-of-War cost around 200k to fully-upgrade which might be a bit too low, but some of the upgrades for a class 2 will cost that alone so I probably need to look at a ship class multiplier. The hull perks seem to be good and the cannon ones should be based on the maximum the ship can use, so I think the ones which need some attention are the sails.

By the way, is one of the gun upgrades supposed to increase the calibre by one?
 
Last edited:
Code:
//Reinforced Hull --- No way back!!!!
#define RHHULLHPRANGEMAX   10     // int 0-100
#define RHHULLHPRANGEMIN   0     // int 0-100
#define RHINERTIARANGEMAX   10     // Not implemented
#define RHINERTIARANGEMIN   0     // Not implemented
#define RHCALIBERADD     1     // Number of calibers up
#define RHDISP         50     // int 0-100 Chance of being available   // Rather easy
#define RHTIMEMULT       1     // Time to repair all hull multiply by RHTIMEMULT
#define RHCOSTMULT       0.2     // Cost of repair all hull multiply by RHCOSTMULT
RHCALIBERADD seems to indicate this, but it doesn’t do anything. Anyway, it doesn’t seem right for this to happen by upgrading the hull. I wonder if it can be applied to a different upgrade? Maybe the two cannon chaser upgrades can effectively be merged and one of them can be turned into upgrading the calibre? If so, the cost would have to be relatively high for the larger ships, but for the smaller ones and some of the merchant vessels it could actually make them useful.
 
RHCALIBERADD seems to indicate this, but it doesn’t do anything.
Is that variable not used anywhere? Must have been an idea then that was never implemented.
Or it was, but it was disabled because it didn't work right.
 
It’s enabled, it just doesn’t actually work.
Code:
     case "rhull":
       applytunhullhp(char,"rhull",RHHULLHPRANGEMAX,RHHULLHPRANGEMIN);
       applytuninertia(char,"rhull",RHINERTIARANGEMAX,RHINERTIARANGEMIN);     
       applytunupcaliber(char,"rhull",RHCALIBERADD);     
     break;
Code:
void applytunupcaliber(ref _char, string _improvement, int inc) {
   _char.ship.tune.(_improvement).on = 1;
   _char.ship.tune.(_improvement).incaliber = inc;
   int cal;
   aref temparef;
   ref tempref;
   tempref=GetShipByType(sti(_char.ship.idx));
   Makearef(temparef,_char.ship);
   int attribute = sti(GetLocalShipAttrib(temparef,tempref,"MaxCaliber"));
   cal = GetCannonCaliberIndex(attribute);
   if(cal != -1 && cal+inc >= CANNON_CALIBERS_MAX) { cal = CANNON_CALIBERS_MAX; }
   if(cal != -1 && cal+inc <= 0  ) { cal = 0;  } // PB: To prevent decreasing too far
   if(cal != -1) { cal=cal + inc; _char.ship.maxcaliber= Cannon_Calibers[cal]; }
}
 
Does it ever get to that final line? It does look like it should do some stuff.
 
Very. I just put this into the console a few times and pushed my maximum calibre to 128-pounders...
Code:
   ref ShipRef = GetShipByType(GetCharacterShipType(GetCharacter(0)))
   int calibre   = ShipRef.maxcaliber
   int cindex = GetCannonCaliberIndex(calibre) 
   ShipRef.maxcaliber = Cannon_Calibers[cindex+1]
But as soon as I put it in that function, it does nothing. It’s being called because a trace passes. :unsure
 
Maybe there are failsafes being triggered in that code that shouldn't be?

Instead of GetCharacter(0) , you can use GetMainCharacter() which is more commonly used for that purpose.
Wouldn't make a difference though.
 
I don’t know, but this is interesting...

According to a DumpAttributes for my character the maximum calibre for the ship is 32lb, which is a complete lie since it’s a Heavy Pinnace. I have just swapped it for a Sloop, which has a 6lb limit, and it still says 32lb. So basically, every time I have been buying that upgrade it has been pushing it up, and it will not go any further now because CANNON_TYPES_MAX says so. So basically, that attribute is not even being read at all, it would appear that whatever looks for this information is looking at the base ship stats instead. If that’s the case then how do some ships end up with a different calibre to another, like two Sloops can be either 6lb or 9lb? This is odd indeed.
 
If that’s the case then how do some ships end up with a different calibre to another, like two Sloops can be either 6lb or 9lb?
Doesn't seem to be national modifiers either, as I had originally though.
That does exist (look up MaxCaliber at the top of ships_init.c), but that is set deliberately to 1.00 for all nations.
 
Actually, are there different types of Sloop? The above code I put in the console was actually a global change to the ship type itself. I did this with a Sloop but one of them did not change, so I guess there are variants of them?
 
Actually, are there different types of Sloop? The above code I put in the console was actually a global change to the ship type itself. I did this with a Sloop but one of them did not change, so I guess there are variants of them?
There are a whole bunch of sloops; see ships_init.c . :doff
 
Back
Top