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

Not a Bug Smuggling: Goods in companion ships remain after deal

Talisman

Smuggler
Storm Modder
I am sure this has been reported before - but I can not find the thread. :(

When I talk to the smugglers on the beach - they pay me for the contraband - but because the goods are in one of my companion ships and not in the players ship, they are not removed.

So the player gets the money and keeps the goods. :rolleyes:

Save attached just before talking to Smugglers on Nevis beach.
 

Attachments

  • -=Player=- Nevis.zip
    826 KB · Views: 94
This should work just fine unless some of those functions are screwed up. I will look into it when I have time, but please first confirm its a problem...

Code:
if(GetCompanionIndex(Pchar, 1) != -1)
                {
                    RemoveCharacterGoods(&Characters[getCompanionIndex(Pchar, 1)], makeint(Pchar.quest.contraband.goodsIDX1), GetCargoGoods(&Characters[getCompanionIndex(Pchar, 1)], makeint(Pchar.quest.contraband.goodsIDX1)));
                }
                if(GetCompanionIndex(Pchar, 2) != -1)
                {
                    RemoveCharacterGoods(&Characters[getCompanionIndex(Pchar, 2)], makeint(Pchar.quest.contraband.goodsIDX1), GetCargoGoods(&Characters[getCompanionIndex(Pchar, 2)], makeint(Pchar.quest.contraband.goodsIDX1)));
                }
                if(GetCompanionIndex(Pchar, 3) != -1)
                {
                    RemoveCharacterGoods(&Characters[getCompanionIndex(Pchar, 3)], makeint(Pchar.quest.contraband.goodsIDX1), GetCargoGoods(&Characters[getCompanionIndex(Pchar, 3)], makeint(Pchar.quest.contraband.goodsIDX1)));
                }
 
Some of the goods functions cycle through all your ships by themselves. But indeed I don't remember add and remove being that clever.
 
On the Latest version of Beta 3-5

Not really sure what is going on here

In both Puerto Rico & Antigua the smugglers pay for the Tobacco - but don't take any from any of my ships .

And Antigua don't pay for or take the wheat.

No error logs are generated

:shrug
 

Attachments

  • -=Player=- Antigua. Muscetto Cove. October 23rd, 1662.zip
    673.4 KB · Views: 88
  • -=Player=- Puerto Rico. Oyster Beach. October 18th, 1662.zip
    671.5 KB · Views: 103
  • system_SmugPR.log
    4.2 KB · Views: 130
  • compile_SmugPR.log
    4.1 KB · Views: 97
  • system_Smug Ant.log
    2.7 KB · Views: 123
  • compile_Smug Ant.log
    2.7 KB · Views: 112
Some of the goods functions cycle through all your ships by themselves. But indeed I don't remember add and remove being that clever.
Indeed RemoveCharacterGoods IS that clever:
Code:
int RemoveCharacterGoods(ref _refCharacter,int _Goods,int _Quantity)
{
    int i,cn,curQuantity;
    string goodsName = Goods[_Goods].name;

    for (i=0; i < 4; i++)
    {
        cn = GetCompanionIndex(_refCharacter,i);
        if(cn!=-1)
        {
            if (IsTrader(GetCharacter(cn))) continue; // KK
            curQuantity = sti( Characters[cn].Ship.Cargo.Goods.(goodsName) );
            if(curQuantity>=_Quantity)
            {
                Characters[cn].Ship.Cargo.Goods.(goodsName) = curQuantity - _Quantity;
                RecalculateCargoLoad(&Characters[cn]);
                return true;
            }
            Characters[cn].Ship.Cargo.Goods.(goodsName) = 0;
            _Quantity = _Quantity - curQuantity;
            RecalculateCargoLoad(&Characters[cn]);
        }
    }
    Trace("Overup cargo space on "+_Quantity);
    return false;
}
So could this be as simple as this?
Code:
        case "Leave_goods":
            int total_smuggle = 0;
            if(FindFirstContrabandGoods(Pchar) != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip1")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,FindFirstContrabandGoods(Pchar));
                RemoveCharacterGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX1), GetSquadronGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX1)));
            }
            if(FindNextContrabandGoods(Pchar) != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip2")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,FindNextContrabandGoods(Pchar));
                RemoveCharacterGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX2), GetSquadronGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX2)));
            }
            if(FindNextContrabandGoods(Pchar) != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip3")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,FindNextContrabandGoods(Pchar));
                RemoveCharacterGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX3), GetSquadronGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX3)));
            }
            if(FindNextContrabandGoods(Pchar) != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip4")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,FindNextContrabandGoods(Pchar));
                RemoveCharacterGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX4), GetSquadronGoods(Pchar, makeint(Pchar.quest.contraband.goodsIDX4)));
            }

And @Levis: What is the difference between FindFirstContrabandGoods, FindNextContrabandGoods and Pchar.quest.contraband.goodsIDX#?
Here is a suggestion of that section of code that uses ONLY the goodsIDX to prevent potential confusion between them all:
Code:
            int goods_index = makeint(Pchar.quest.contraband.goodsIDX1);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip1")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }
            goods_index = makeint(Pchar.quest.contraband.goodsIDX2);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip2")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }
            goods_index = makeint(Pchar.quest.contraband.goodsIDX3);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip3")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }
            goods_index = makeint(Pchar.quest.contraband.goodsIDX4);
            if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip4")) 
            {
                total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
                RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
            }
I didn't test this though, so I don't know if this is better or not.
 
As far as I can see it does exactly the sam now. But let me check it, I got time now.

The get contraband functions check if you have a contraband good on board. the first one also does some clean up work, after that it has a counter so it can check if you got that contraband already.
I prefered to do it differently, but this is how it was set up in the past.
 
The get contraband functions check if you have a contraband good on board. the first one also does some clean up work, after that it has a counter so it can check if you got that contraband already.
I prefered to do it differently, but this is how it was set up in the past.
Indeed I looked through the related code a bit further and it looks like it should work. The changes I made theoretically should make no difference, I agree.
So whether this is better/worse/the same, I do not know. I'm hoping it at least did some good. :shrug
 
It seems to be working now ... dunno why it didn't before tough.
You made a small mistake @Pieter Boelen . The IDX isn't present if there is no contraband good. I still want to rewrite this all so you can actually have more then 4 contraband goods on an island. For now this fix should work.
 

Attachments

  • Smuggler_OnShore_dialog.c
    24 KB · Views: 134
Hello again. I started a new Hoist The Flag storyline with beta 4 and i decided to do some smuggling right at the beggining before i reach speightstown. Went to Aruba and started trying so i encountered all the bugs previously posted here (double characters after talking to officer and black screen, being caught by coastguard before talking to smugglers) but i also encountered a couple more things.

Keep in mind that i had some or all of the goods on Thomas the Terror ship. don't know if it creates the problems but i should mention it.

1) I had two goods but could only gain profit from one of them even though i was dealing for both
909cvh
909dha
909e17


2) When later i tried to smuggle again at curacao and bonaire the goods that were in the companion ship remained there after i made the deal and got paid for it. I also had one of the goods i dealed in the above i think. I didn't take screenshots of this.

I don't think i have the logs cause i am not sure how to do that. I have seen the files in the folder (i think that's them) but should i do something to enable logging to work first? when am i supposed to use them? should the game still be open when i copy them? if i know this i'll make sure to provide them along with a save game if possible next time
 
The logs are auto generated in your potc folder.
Each time you start the game they are cleared.

Thomas is an companion right? Shouldn't his cargo be locked @Pieter Boelen
 
We have had this problem before, prompting me to attempt a rewrite of the smuggler dialog file to hopefully fix it.
I thought that was confirmed to have worked properly?

@jack sparring: Just to be sure, please post the compile.log file from your main game folder.

Thomas is an companion right? Shouldn't his cargo be locked @Pieter Boelen
Many storyline companion characters probably should be locked like that, but only the Standard Storyline ones actually are. :shrug
 
Ok i didn't have the compile.log from then but i had a saving point just before then so i tried to retrace my steps. this time both goods removed from cargo (i had one in each ship) but again got paid for the second deal only.
 

Attachments

  • compile.log
    17.4 KB · Views: 87
Can you post that Save too and let us know how to retrace those steps?
 
I hope i upload them correctly. I went to a later save and tried to trigger the 'still in cargo' bug and it happened again.

so first save i am in aruba tavern having talked once with smuggler. i think i talked again, then went out, found the old captain in the house in front of port then to the deck. after i leave a town i always check the ship's chests to find whatever new is there then to sea. sometimes when in a hurry or when the wind is too low i might use sail-to. cant remember if i did it then but i did it now.

second save in charlestown tavern already having talked twice and with guard then straight to the deal point after same routine. the 39 ebony in companion's ship remains.

here are both saves and second save compile.log
 

Attachments

  • -=Monkey D Luffy=- Aruba.7z
    502.6 KB · Views: 101
  • -=Monkey D Luffy=- Nevis.7z
    554.1 KB · Views: 91
  • compile.log
    14 KB · Views: 104
Back
Top