3. Create Shop with Inventory Component {{ currentPage ? currentPage.title : "" }}

In this Tutorial we will create a Player Shop with a Consumable Item.

Read more about Consumable Items!

Please read this Tuturial, even if you do not use the Inventory Component to understand how to create a Shop!

1. Create a new Gameplay Tag and call it Item.ConsumableType.openPlayerShop.

2. Create a new Consumable Item.

Set the ItemType to Item.Type.Consumables and set the Consumable Type to Item.ConsumableType.openPlayerShop.

You can setup everything else however you want.

In this Tutorial you can read more on how to create Items.

3. Without PlayerTemplate: Open the Interface Function SP8_UseConsumable and do following:

  • Check if the Consumable Type is the Type Item.ConsumableType.openPlayerShop. (You can use a switch as well)

  • If yes, save the Inventory Index as Variable.

  • Open the Shop Window (Should be empty, like the Window should look when creating a new Shop) on the Client.

  • Return false (The Consumable Item should be removed later).

4. With PlayerTemplate: Go inside your Player BP to Class Defaults and set the Variable Consumable Type Open Player Shop to the Gameplay Tag Item.ConsumableType.openPlayerShop.

Now if the Player uses the Consumable Item, it will open his Shop Window.

Please look inside the SP8_WBP_Shop inside the Directory RPG_Essentials / Example / Widgets to understand how to create a Widget.

Now we need to set the logic, what is going to happen if he is done adding the Items to the Window and click the Create Shop Button.

5. Without PlayerTemplate: Open the Interface Function SP8_CanCreatePlayerShop and do following:

  • Call TryToRemoveConsumableItem on the Inventory Component.

  • If it worked, return true, so the Player will be able to create the new Shop.

If you call now createShop on the PlayerShopComponent, it will spawn your Actor a few Meters away of the Player.

{{{ content }}}