Merchants¶
The Inventory module comes with a built-in system that allows two Bags to trade their contents in exchange for a specified Currency.
Merchant Component¶
To initiate a trade between two Bags, one of them (the merchant) must have a Merchant component attached along a Bag component.
- The Bag component provides the stock of items available.
- The Merchant component determines the type of transactions made.
Merchant Info¶
The Merchant Info section allows to give the Merchant a name and a description. This is completely optional, but can be useful to display the type of trading made by a certain Merchant.
Example
For example, having a merchant called Herbologist already gives a clue of the type of Items this merchant trades with.
Configuration¶
- Infinite Currency: If checked, the Merchant will have an infinite amount of currency supply to buy Items from the client (Player). Otherwise it will use the Bag's wealth.
- Infinite Stock: If checked, the number of available Items will not decrease after the client (Player) purchases them. Otherwise, the available stock decreases with each purchase made.
- Allow Buy Back: If checked, every Item sold by the client (Player) is automatically added to the Merchant's stock. Otherwise, any Item sold cannot be recovered.
- Sell Niche Type: If checked, it allows to filter the type of Items sold by this merchant, regardless of its Bag content. For example, if a Merchant only sells Herbs, even if its Bag contains a Sword, it will not be available for sale.
The Buy Rate is the discount coefficient that the Merchant provides when buying Items from the client (Player). A value of 1 indicates the Items sold have no discount. To provide a 90% discount on all Items, this field should be set to 0.9.
The Sell Rate is the coefficient applied when the Merchant purchases Items from the client (Player). In most games, the selling price of an Item is lower (commonly half the price) than its real one.
The Bag field is a reference to the Bag component from where the Merchant takes its stock.
Reference a Bag
If your Bag is placed along another game object, you can change the value of this field from Self to Bag and manually reference the correct object.
Skin UI is the user interface skin used by this merchant.