Transfer to another character safely
Figure 20. After transfer, the key leaves Builder’s bag and appears in Assistant’s bag.
extends "res://scripts/runtime/script_base.gd"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 trueThe 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.
