Skip to reading
GDScript Programming & Godot

Gameplay: Inventory and two-object interactions

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

An inventory definition describes an item. Giving an item changes a bag. Removing its scene model is a separate instruction. Decide whether the project uses shared or character-specific inventory before writing transfers.

AddInventory()#

Add Inventory

Add copies of an existing inventory item through the runtime's active inventory route.

Source table from Gameplay: Inventory and two-object interactions, page 94
Option key / fieldMeaning and inputDefault
Item itemIdChoose an inventory definition ID.Blank
Count countNumber of copies or repetitions. Use a whole number.1

Timing. Waits for the runtime routine to return; no further completion wait is promised by this schema.

Code example
await AddInventory({"itemId": "key", "count": 1})

In use. Add one Archive Key after a successful pickup. This is not a command to import a model, and it does not hide the key on the workbench. Use Give Inventory in the room/object inspector when this entry is not listed there.

Page 94 of 378Permalink
Go to page