Storm Game Framework 2.0.0
User guide
Loading...
Searching...
No Matches
Give the player an item

Create a supply kit and give one to the player when the starter game mode spawns their character. Then add a small Blueprint inspection so you can see the inventory during play.

Before you start

Complete Change your character. Keep the starter's hand loadout empty for this chapter. The item will be owned before it is equipped or displayed.

Create the supply kit

  1. In Project Settings > SGF > Storm Items Editor, set Item Content Root to the Tutorial/Items folder inside your starter folder.
  2. Open SGF > Project Dashboard and choose Items > Create Item.
  3. Enter SupplyKit. Review the destination: it should end in Tutorial/Items/SupplyKit/DA_SupplyKit. Click Create.
  4. In Item Designer set Name to Supply Kit, Description to A kit required to open the supply-room door, and Max Stack Size to 1. Save.

Leave classification, icon and world representation unset for now. This item represents ownership; a later chapter will add a simple character prop for its equipped state.

Assign the starting grant

Open BP_PlayerCharacter_GameMode > Class Defaults > Starter Item. Expand Definition Id and select type StormItemArchetype, name DA_SupplyKit. Compile and save.

This primary asset ID names the item asset. Starter Item is the game mode's instruction to grant one instance when it spawns an inventory owner. It is separate from the equipment loadout.

The item's folder is inside the existing StormItemArchetype scan directory. Check Project Settings > Game > Asset Manager if the ID does not resolve. Keep Has Blueprint Classes and Is Editor Only off for this type.

Add an inventory inspection key

Open BP_PlayerCharacter in the full Blueprint editor. This is a development inspection graph; it does not change the inventory.

  1. Create a function named DescribeInventory.
  2. Drag Inventory from Components into the graph as a getter. From it add Get Inventory Entries. Connect the function entry's execution pin to this call.
  3. Connect Out Entries to a For Each Loop. For each Array Element, add Break Storm Inventory Entry.
  4. From its Item, add Break Storm Item Reference. Connect Definition Id to To String (PrimaryAssetId), then to Print String. Connect the loop's Loop Body execution pin to Print String.
  5. To inspect identity, break the entry's Instance Id, convert its Value GUID to a string and print it too. Then print the entry's Quantity (an integer: use To String (Integer)). It tells you how many units that stack contains.
  6. In the Event Graph, add the keyboard 3 event. Connect Pressed to DescribeInventory. Compile and save.

The nodes may appear as interface calls when dragged from an inventory reference. Use the inventory component as the target. If Context Sensitive hides a node, drag from the relevant typed output pin first.

Play and check

Play L_SetupTest, wait until the character moves, then press 3. You should see StormItemArchetype:DA_SupplyKit, a quantity of one and an instance ID. Record that ID for this play session.

The archetype ID identifies the item kind. The instance ID identifies the copy you own. Restarting Play creates a new pawn and grants a new instance, so its instance ID can change.

To check the grant is explicit, stop Play, clear Starter Item on the game mode, compile and play again. Press 3: the inventory should be empty. The DA_SupplyKit asset still exists. Restore its Starter Item ID before continuing.

For clearer empty-inventory feedback, branch on the entries array's Length before the loop and print Inventory is empty when it is zero. Print String is a development diagnostic; a player-facing inventory screen is a separate UI task.

If something does not match

Symptom Check
The old starter item is granted. Check Starter Item on the game mode selected by this map.
The ID is invalid or no item is granted. Check the type/name, asset scan and Output Log for the starter grant warning.
Nothing prints. Click the play viewport, wait for character readiness, then press 3. Check the function's execution wires.
The item is not visible in the hand. Inventory ownership is this chapter's result. Equipment and display come next.

Checkpoint: a fresh Play session grants the supply kit and you can inspect its kind, quantity and instance identity from Blueprint.

Next: Equip and show the item.