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.

Fixed Shipyard ship replacement- cargo price given as deduction but cargo retained

Discussion in 'Bug Archive' started by Tingyun, Oct 14, 2016.

  1. Tingyun

    Tingyun Corsair Storm Modder

    Joined:
    Aug 8, 2016
    Messages:
    1,445
    Gender:
    Male
    When you sell a ship, the cargo price is included in sale price, which is of course correct.

    Things go wrong though if you are replacing the ship (ie, buying a new ship at the same time). You get paid for the cargo, but you still keep the cargo.

    Bug is easy enough to see in action, if you have a ship with lots of cargo, simply replace it back and forth with repeated purchases of another ship, and your gold with grow more and more with each purchase (from the cargo you get money for each sale but keep).

    Searching the archives shows that this bug was reported before, and deemed fixed, but it seems to be a miscommunication, where what was fixed was actually a related but different bug: Medium Priority - Shipyard Sale Price: Cargo Included, but Kept Anyway | PiratesAhoy!
     
  2. Talisman

    Talisman Smuggler Storm Modder

    Joined:
    Apr 29, 2009
    Messages:
    2,825
    Gender:
    Male
    Location:
    Hiding From The Coastguard


    Stupid Question - Why are you selling a cargo ( sandal, leather, cinnamon etc.) to the shipyard :confused: - and are the prices you are getting the same as in the store ?

    The player should be selling those things to the store - a shipyard is not interested in buying such things.

    Perhaps interested in wood, sails, Ammo, gunpowder ( i.e. ship supplies) :yes

    Or is it just to enable players to be lazy and not have to go to the store and sell things.

    :read
     
    Tingyun likes this.
  3. Tingyun

    Tingyun Corsair Storm Modder

    Joined:
    Aug 8, 2016
    Messages:
    1,445
    Gender:
    Male
    Yes, it checks store price from what the code looks like.

    I think it is indeed the convenince factor, combined with not wanting to punish a player who forgets to first sell the cargo. Can perhaps understand it as ordering the quatermaster to run to the local store to sell all goods prior to the ship sale.
     
    Talisman likes this.
  4. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,586
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    ^ Exactly that.

    It also makes sense for any Prize Ships, since ideally those should be sold with their cargo still on board.
     
    Tingyun likes this.
  5. Tingyun

    Tingyun Corsair Storm Modder

    Joined:
    Aug 8, 2016
    Messages:
    1,445
    Gender:
    Male
    I think the cargo sale addition code is after the prize ship reduction (perhaps it was moved), so the player will still get 100% of the cargo profit even if they voluntarilly enforce that rule, rather than the proper prize ship percentage. Makes sense given the player can just bypass it anyway, but also a little sad there is no roleplaying option to follow the historical prize law rules.

    One thing I don't like is that damage to sails/hull is deducted after the prize multiplier. So basically the entire repair cost for any damage comes out of the player's cut, rather than being shared by everyone, as would seem more fair.
     
  6. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,586
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I tried to make it more fancy for that, which was met with MAJOR resistance. In the end, I went with "I don't bloody care anymore" and reverted it back to how it used to be.

    Shame really, because I liked the idea that the cargo IS part of the prize.
    Problem with that was that you cannot trace where cargo originated, so basically I had to lock cargo on prize ships altogether.
     
    Tingyun likes this.
  7. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,683
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    This is what happens during DoSellShip
    Code:
    if ( cargoHandler == "includecargo" ) { // TIH added handler Jul27'06
            // Viper - Add Cargo Value to Ship Price -->
            int p, tQuantity;    ref refStore;
            ref refCharacter = GetCharacter(cn);
            int curStoreIdx = GetCharacterCurrentStore(GetMainCharacter());
            makeref (refStore, Stores[curStoreIdx]);
            //p = 0; // NK
            for(int i=0;i<GOODS_QUANTITY;i++)
            {
                if( !GetStoreGoodsUsed(refStore,i) ) { continue; }
                tQuantity = GetCargoGoods(refCharacter,i);
                if( tQuantity==0 ) { continue; }
                RemoveCharacterGoods(refCharacter,i,tQuantity);
                // NK -->
                //p += GetGoodPriceByType(&refStore, GetMainCharacter(), i, tQuantity, PRICE_TYPE_SELL);
                SetStoreGoods(refStore,i,GetStoreGoodsQuantity(refStore,i)+tQuantity);
            }
        }
    
    So it should remove the goods from you and add them to the store....
    So could you check if this is actually executed?
     
    Tingyun likes this.
  8. Tingyun

    Tingyun Corsair Storm Modder

    Joined:
    Aug 8, 2016
    Messages:
    1,445
    Gender:
    Male
    @Levis it does seem to work fine and is executed for selling a ship normally, but if you buy a replacement ship and sell your own in one action, you get the cargo value as a discount plus you keep the goods as they appear automatically in the new ship's cargo hold. You can axtually keep replacing ships, and watch your money go up and up with each replacement sale.
     
  9. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,683
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    it should keep the cargo as you see here:
    Code:
    // TIH --> fixed price bug Jul27'06
        int bPrice = GetBuyPrice(nCurSScrollNum);
        int sPrice = GetSellPrice(nCurFourNum,"skipcargo");
        int buyPrice = bPrice - sPrice;
        if ( IsMoneyForBuyEnable(bPrice, sPrice) > 0 ) return;
        // TIH <--
    
        ref chref = GetCharacter(cn);
        DoSellShip("keepcrew","keepcargo");// TIH keep any stuff around as we only swap ships (or add ship to companion) Jul27'06
    
        AddMoneyToCharacter(GetMainCharacter(),-bPrice); // PW was buyPrice ie the exchanged cost but you got the sell money as well
    
    So this should sell the ship without using the money from the goods...
     
    Tingyun likes this.
  10. Tingyun

    Tingyun Corsair Storm Modder

    Joined:
    Aug 8, 2016
    Messages:
    1,445
    Gender:
    Male
    Maybe something is wrong with the skip cargo functionality.

    Either way, when replacing your ship with a new one, you certainly do get the cargo discount and keep the cargo.

    By repeatedly swapping ships at the shipyard by clicking buy buy buy between two cheap ships over and over again, you can watch your money grow with each click. It is an infinite money cheat actually, so the bug is very clear as long as you have a ship wih full cargo.
     
  11. lapuvida

    lapuvida Landlubber

    Joined:
    Oct 27, 2016
    Messages:
    17
    Gender:
    Male
    As this is my first post on this board, i have to apologize for starting in the bug section... You provide a really great mod here which brought me back to playing this fantastic game after years, so it´s not polite to start with a post adressing something that might not be working perfect so far.

    But anyway, i observed the same behaviour when selling the old ship combined with buying a new ship exacly as Tingyun described it.

    Regarding the two quotes above i would like to add that this is not only working with goods sellable at the store, but that you can also "sell" smuggling goods via the shipyard. I think this misfits the idea mentioned above that selling the goods with the ship is more or less to be seen as a command given to the quartermaster to sell all remaining goods left in the cargo. And as the normal goods, also the smuggling goods remain in the cargo when switching ships.
     
  12. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,586
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    No worries; bug confirmations are appreciated too. :doff

    And confirmed it is! :cheers

    Really? Normally there should be a note stating "Smuggling goods on board" or something like that and then you are unable to sell the ship. o_O
     
  13. lapuvida

    lapuvida Landlubber

    Joined:
    Oct 27, 2016
    Messages:
    17
    Gender:
    Male
    I checked again a few minutes ago and unfortunately have to confirm this. It is possible to sell a ship full of smuggling goods, and not only by switching (buying) directly to a new ship but also when selling the ship without directly buying a new one. There was no note popping up at all.

    If it might be good to know, i am playing with the 7th october zip. I cannot confirm it anymore but if i remember the right way this (meaning switching ships without loosing cargo and also selling ships with smuggling goods in cargo) was already possible with the 28th July version i was playing before. But as i am not a 100% sure maybe someone still using that version should have a short test?!
     
  14. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,586
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    @Levis, you have any clues on this one?
    I thought that "unable to sell while Smuggling goods are on board" thing was working not too long ago. :shock
     
  15. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,683
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    @Pieter Boelen would you be able to confirm it also not working in the 28th of july version?
    This weekend I've planed to look at stuff like this
     
  16. Cassadar

    Cassadar .apples{display:none;} Storm Modder

    Joined:
    May 31, 2013
    Messages:
    284
    Occupation:
    being a rough and grumpy person
    I still have the July version as a backup and tried this. You are indeed not able to sell your ship while having smuggling goods on board. However, this wasn't the case anymore as soon as the perk 'Trustworthy' was learned.
    The same happened in Levis's latest October ZIP btw, for both cases, so as far as I can see nothing is broken here.
     
  17. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,586
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I cannot give any guarantees; this evening I need to sort out some paperwork and tomorrow I've got a fair few activities.
    Looks like @Cassadar was already kind enough to check it though.

    That does sound like it works like it should then. :onya

    Could you check if you have the Trustworthy ability?
     
  18. lapuvida

    lapuvida Landlubber

    Joined:
    Oct 27, 2016
    Messages:
    17
    Gender:
    Male
    Indeed yes, a recently hired officer brought this ability along, sorry for not considering this :oops:

    So the bug is only about the remaining cargo after buying a new ship, but there it is still unclear if that was already present in the 28th July version.
     
    Pieter Boelen and Levis like this.
  19. pedrwyth

    pedrwyth Privateer Storm Modder

    Joined:
    Jan 8, 2015
    Messages:
    646
    Gender:
    Male
    As suggested above

    an initial look at this with some trace logging does indeed show that "skipcargo" calls are currently including the cargo value which has several effects.

    1) The one noted above when swapping ships you both keep the cargo but also get its value.
    2) The initial values shown for your ships include cargo which IMO can mask their real trade in value when window shopping in the shipyard.
    3) The price you get on a straight sale doesn't clarify how much is for ship and how much is for cargo which doesn't help judge if its a good deal.
    4) The ship swap price is incorrectly displayed.

    I'm working at the various uses of skipped or included cargo to massage them back to what they seem intended to be. I didn't check the functionality of this element out (just looked at the code) when previously finding you getting the traded in ship value twice in the earlier thread as reported in #1 above - my (big) mistake.

    I will also take a look at this one at the same time if I can

    http://www.piratesahoy.net/threads/ship-upgrades-interface-shows-ticks-for-wrong-ship
     
    Pieter Boelen and Levis like this.
  20. Pieter Boelen

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

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

Share This Page