Skip to content

Pt 5: Pickup items to player inventory



Set Pickup condition when item found, what to do depend on player inventory size


In PlayerBase BP, add new function, called PickupItem:
Promote local variable called ItemINC (INC stands for item incoming )
image.png
Continue:
Equal node has to type Equal (Enum) to connect to itemID output
Upper iteminfo S to check what’s holding in inventory, bottom iteminfo S to check what’s pickup
image.png

To set if (un)add item in inventory after complete a loop:

image.png

Create a 2 child from Base Interactable BP, called HealthPotion BP, Steak BP
Open ItemID _E, add
image.png
in data table, set (item ID in table has to match exactly as item ID_E):
image.png

Open HealthPotion BP, change item ID:
image.png
Repeat the same on Steak

Back to Datatable, change the item ID name and give the same name as the ID, on both 2 items:
image.png

Open PlayerBase BP, create:
image.png

Test the BP if it works by using print string:

Player base BP:
image.png
Base interactable BP:
image.png
Drag the steak and healthpotion BP to scene to test
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.