Vendor System
UE5 Inventory and Item System Version: 3.0The vendor is an interactable npc where your players can buy and sell items. To add a vendor to your world, navigate to the Blueprints/Interactables/NPCs/Vendor folder and drop a copy of the BP_NPC_Vendor into your world.
Buyable Items
Each of your vendors can offer a different number of buyable items. You can configure your buyable items by selecting the AC_Vendor component on the Vendor NPC, then navigating the details panel to the BuyableItems section. Each item in this array will appear on the vendor. To change the order they appear in, just rearrange the array. It might be a good idea to make childs of the BP_NPC_Vendor blueprint with your BuyableItems already set for the common vendors you plan on reusing throughout your game.
Each buyable item has the following fields:
Sellable Items
The prices and currency for items the player can sell to the vendor are set in the DT_Items data table. Each item has the fields ItemSellPrice and ItemSellCurrency. This is where you would specify the sale price and currency. This ItemSellPrice is the base price, before the sell multiplier on your vendor is applied.
By default the SellItemMultiplier on each vendor is set to 0.5, which results in paying the player half of whatever the value you set in the data table for ItemSellPrice.
You can change the default SellItemMultiplier on all vendors by editing the value inside the AC_Vendor component. To change just a specific one select the AC_Vendor component on it in the world and adjust the value there.
Let’s say you have a reputation system, or a charisma talent that boosts how much vendors will pay the player for items sold to them, this SellItemMultiplier is something you can change at runtime that will adjust the payout. The higher this value is, the more the vendor will pay for it.
Keep in mind this is only on the sell side, and this will not affect the buy prices. If you need to apply a multiplier to the buy prices as well you are going to need to modify the logic inside the AC_Vendor.
The ItemSellCurrency does not have to be a currency item. In our demo world if you try to sell a loot box to the vendor, the vendor will pay you in raw meat! You can however turn around and sell the raw meat back to them for silver coins.
The flexibility of the ItemSellCurrency opens up a lot of possibilities for you, like being able to offer redeemable tokens when a piece of raid gear drops for the player that they have no interest in. You can also use it as a way to spawn limited access items, maybe as a requirement for a quest or crafting recipe, or maybe even as an easter egg.
Vendor UI Player Currencies
The player currencies that sho on the vendor UI can be changed for each vendor using the ShowCurrencies variable found on the BP_NPC_Vendor. Each item in this array is a row name to a currency found in your DT_Items data table.