How to Add a Vendor NPC
This guide explains how to create a vendor NPC using the
BP_RPG_AI_NPC_Shop base class. By the end, you will have a
shopkeeper in the level with a configured inventory and price
coefficients for buying and selling.
Prerequisites
- RPG Engine v6 project with trading and inventory systems
enabled.
- Existing
BP_ItemDataassets for all items you want the NPC to sell.
- GameplayTags configured for item types (for example:
ItemType.Weapon,ItemType.Ammo, etc.).
Step 1 – Create a Vendor NPC Blueprint
- In the Content Browser, navigate to the folder where you keep AI/NPC
blueprints.
- Right-click
BP_RPG_AI_NPC_Shopand choose Create Child Blueprint Class.
- Name the new blueprint something like
BP_NPC_Shop_Trader01.
- Open the new child blueprint.
Step 2 – Configure the NPC Character Skin
- In the Components panel, select
BP_CharacterSkinComponenton your vendor blueprint.
- In the Details panel, find the Start Character Skin
parameter.
- Assign the desired player character skin asset so the NPC uses that
appearance in the world.
- Compile and save the blueprint.
Step 3 – Place the Vendor NPC in the Level
- Drag your
BP_NPC_Shop_Trader01blueprint from the Content Browser into the level.
- Position and rotate the NPC where you want the shop to be
located.
- With the placed actor selected, open the Details panel to configure shop settings.
Step 4 – Configure Items for Sale
- In the Details panel of the placed NPC actor, find the
ItemsForSale property.
- Add elements to the
ItemsForSalearray (type:S_ItemForSale).
- For each element:
- Set Item to the
BP_ItemDataasset of the item this NPC sells.
- Set Quantity to the number of units this NPC offers
(integer).
- Set Item to the
- Repeat for all items that should be available from this vendor.
Step 5 – Set Sell Coefficients (Player Sells to NPC)
- In the Details panel, locate Sell Coefficients
(type:
TMap<GameplayTag, float>).
- Add entries for each item type tag you want to control, for example
ItemType.Weapon,ItemType.Ammo, etc.
- For each entry:
- Key: the item type GameplayTag.
- Value: a float multiplier applied when the
player sells items of this type to this NPC.
- Key: the item type GameplayTag.
- Use higher values for item types where this NPC pays more (better prices for the player) and lower values where the NPC is stingy.
Step 6 – Set Buy Coefficients (Player Buys from NPC)
- In the Details panel, locate Buy Coefficients
(type:
TMap<GameplayTag, float>).
- Add entries for the same or additional item type tags, as
needed.
- For each entry:
- Key: the item type GameplayTag.
- Value: a float multiplier applied when the
player buys items of this type from this NPC.
- Key: the item type GameplayTag.
- Use lower values for item types that should be cheaper for the player and higher values for more expensive categories.
Step 7 – Test the Vendor in Game
- Play in editor (PIE) and approach the vendor NPC.
- Use the interaction key to open the shop UI.
- Verify that:
- All configured
ItemsForSaleappear with correct quantities.
- Buying prices respond to Buy Coefficients per item
type.
- Selling prices respond to Sell Coefficients per item type.
- All configured
If everything works as expected, your vendor NPC is ready and can be duplicated or further customized (appearance, dialog, location) as needed.