World of Banished

MODS Garage => Tips and Help => Topic started by: angainor88 on April 28, 2021, 05:27:11 PM

Title: Bug Fixing - Trader Boat
Post by: angainor88 on April 28, 2021, 05:27:11 PM
I am having trouble trying to find where the bug is in my code. Does anyone have the time/patience to help?

Whenever I test the trading post mod, it crashes as soon as the boat docks. I must be missing something, but I don't know what :/

Link for the files:https://www.mediafire.com/file/k7hozw86pwb9ym0/A8JapaneseMisc.zip/file (https://www.mediafire.com/file/k7hozw86pwb9ym0/A8JapaneseMisc.zip/file)
Title: Re: Bug Fixing - Trader Boat
Post by: angainor88 on May 03, 2021, 05:01:08 PM
So, it doesn't happen with all boats: the grain and luxuries suppliers seem ok.

This is the error message I get:
Title: Re: Bug Fixing - Trader Boat
Post by: kid1293 on May 03, 2021, 07:44:20 PM
I checked the code and couldn't find anything wrong.
All flags seem to be included. You link them with the NewLimits-files...

That crash is usually a flag problem.
The boat comes with something that is not declared in the code and it crashes.

I will have a second look.
Title: Re: Bug Fixing - Trader Boat
Post by: kid1293 on May 03, 2021, 07:49:06 PM
 ;D It took a minute now when I knew what to look for.
There is the letter 'l' after Custom9 in the code. That is a reason for crashing.


      {
         StringTable _stringTable = "Dialog/NewLimitStringTable.rsc:merchant";
         String _merchantName = "MerchantProtein";
         int _itemCount = 15;

         RawMaterialFlags _sellFlags = Protein;
         RawMaterialFlags _wantFlags = Wood | Stone | Iron | Fuel | Tool | Health | Edible | Textile | Clothing | Alcohol | Grain | Fruit | Vegetable | Protein | CoalFue | Custom0 | Custom1 | Custom2 | Custom3 | Custom4 | Custom5 | Custom6 | Custom7 | Custom8 | Custom9l;
         RawMaterialFlags _buyFlags = 0;
      }


Title: Re: Bug Fixing - Trader Boat
Post by: kid1293 on May 03, 2021, 08:00:37 PM
- There is also the letter 'l'  missing in CoalFuel
in the same trader.
Title: Re: Bug Fixing - Trader Boat
Post by: angainor88 on May 04, 2021, 07:40:24 AM
Ah! Thank you for your help!

I will try out these fixes after work :D
Title: Re: Bug Fixing - Trader Boat
Post by: angainor88 on May 04, 2021, 05:13:37 PM
Well, I hoped it would fix it, but no luck so far...

The Merchant Grain, Merchant Textiles, Merchant Alchohol, and Merchant Organics all work, but I can't see which trader is the one that breaks it, alas.

I will keep looking, but I never seem to find anything :(
Title: Re: Bug Fixing - Trader Boat
Post by: kid1293 on May 04, 2021, 09:15:19 PM
@angainor88

I have had this problem. It comes back to me now.
I'll try to explain.

You have a trader who comes with 'Custom4' and only 'Custom4'.
You can not guarantee that he has any goods, because you have no 'Custom4' items in the mod.
When he arrives, he is empty - Crash!

I had to add some other flags to each trader so they didn't come empty-handed.

Reduce the number of traders. Combine the flags so that each trader is covered with something
that is actually in the game.

I hope it makes sense :)
Title: Re: Bug Fixing - Trader Boat
Post by: angainor88 on May 05, 2021, 07:24:25 AM
Ah ok! I can try to fix that!

Thank you for helping me as always :)
It is nice to have experienced people who have seen all these bugs before
Title: Re: Bug Fixing - Trader Boat
Post by: kid1293 on May 05, 2021, 11:08:21 AM
It is nice with people with bugs? ;D

You're welcome :)
Title: Re: Bug Fixing - Trader Boat
Post by: angainor88 on May 06, 2021, 10:48:26 AM
It appears to work now! Thank you!

I am going to do some more testing now...
Title: Re: Bug Fixing - Trader Boat
Post by: kid1293 on May 06, 2021, 11:41:38 AM
:) Great!