UE5 Inventory and Item System
This page is part of the documentaiton for my UE5 Inventory and Item System

Vendor System

UE5 Inventory and Item System Version: 3.0

    The 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:

    ItemRowName This is the item the player can buy from the vendor.
    ItemQuantityPerBuy This is the quantity of the ItemRowName the player will receive for each purchase.
    AvailableQuantityStart This is the starting amount the vendor will have on begin play. If you set this to -1 the available quantity will be unlimited.
    AvailableQuantityMax This is the max amount the vendor can have (replenished through restocking). This is only used if AvailableQuantityStart is not set to unlimited (-1).
    AutoRestockOverTime- This will enable the restocking of buyable items over time until the AvailableQuantityMax is reached.
    RestockRateInSeconds This is the number of seconds it takes between restocks of this item.
    RestockRatePerItem If set to true the restock will increment the current available quantity. If set to false the restock will refill the available quantity to the value of AvailableQuantityMax.
    SellPrice This is the amount of currency purchasing this item will cost the player.
    SellCurrency This is the type of currency the item is being sold for at the SellPrice.
    OverrideData If you want to override or add to the default item data provided through the DT_Items data table for this item being sold by the vendor you would add your item data keys and values here.

    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.

    This documentation and asset version are new. If you encounter any bugs or if anything doesn't make sense, please let me know.