1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Included in Build Rebalanced Ship Upgrade Costs

Discussion in 'Features Archive' started by Mere_Mortal, May 8, 2016.

  1. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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?
     
  2. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Look at KB_routines.c . There is plenty of logic to it, but I'm not sure if the balancing is quite right.
     
  3. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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.
     
  4. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Good luck. :onya
     
  5. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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: May 9, 2016
  6. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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.
     
  7. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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: May 9, 2016
  8. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Maybe....? I honestly can't remember now....
     
  9. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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.
     
  10. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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.
     
  11. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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]; }
    }
    
     
  12. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Does it ever get to that final line? It does look like it should do some stuff.
     
  13. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    I’ve been commenting the first two statements and it still doesn’t do stuff.
     
  14. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
  15. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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
     
  16. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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.
     
  17. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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.
     
  18. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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.
     
  19. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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?
     
  20. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    There are a whole bunch of sloops; see ships_init.c . :doff
     

Share This Page