Skip to reading
Save Games & Inventory

Transfer to another character safely

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 illustrations

Figure 20. After transfer, the key leaves Builder’s bag and appears in Assistant’s bag.

Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func run(_context: Dictionary = {}) -> Variant:
    if not HasInventory("brass_key", "tester"):
        return false
    await TransferInventory({
        "fromCharacterId": "tester",
        "toCharacterId": "assistant",
        "itemId": "brass_key",
        "count": 1
    })
    return true

The source and destination are character IDs. This is an explicit game operation, not a drag between two read-only owner views. Check the recipient’s carrying restrictions and stack capacity for important exchanges.

For a trade, do not remove payment and announce success before checking that the other character can receive the item. Design a clear failure path.

Page 30 of 96Permalink
Go to page