Shop selling category restriction

Hi there - hope you are all doing well!

I have a question that I couldn't find an answer to in the docs, code, or forum, but I'm sure I've missed it.

What's the best way to restrict the categories of items the player can sell in a given shop (e.g., only smithed goods at a blacksmith, or only baked goods at a bakery). Currently, the entire player inventory shows up for selling purposes in every shop.

Thanks!
 
Hey there :)

You can do that the same way you would filter any InventoryGrid.

The easiest option is to use UIDesigner to add a filter to the InventoryGrid of the Shop.
Learn more about filters on those pages:

In the demo scene for example we use tab filters to displya only weapons, or Materials, etc... by switching tabs.


Note that it will limit both the item shown by the shop and the player Inventory because it uses the same grid to display both.

So if you need to have a different filter for shop items and Inventory items, there isn't a straight forward way to do it.
I would suggest 2 options:

1) When pessing the Shop or the Sell button you invoke a custom script function that switches the filter used by the InventoryGrid of the shop

2) You make a custom ShopMenu and either do the same as option 1 or use two seperate InventoryGrids on for the shop inventory and another for the player inventory.

I hope that helps :)
 
Top