Skip to reading
GDScript Programming & Godot

TransferInventory()

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

Change Inventory from Player to Player

Move a quantity from one character's inventory to another.

Source table from TransferInventory(), page 96
Option key / fieldMeaning and inputDefault
From Player fromCharacterIdChoose a Character Designer ID; player is a runtime alias where supported.Blank
To Player toCharacterIdChoose a Character Designer ID; player is a runtime alias where supported.Blank
Inventory Item itemIdChoose an inventory definition ID.Blank
Quantity 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 TransferInventory({"fromCharacterId": "", "toCharacterId": "", "itemId": "key"})

In use. Transfer the key from Ivo to Elias in a game with individual bags. Check the source character and quantity before playing a handover animation. Changing which character is controlled is not the same thing as transferring an item.

Page 96 of 378Permalink
Go to page