Skip to reading
GDScript Programming & Godot

Game queries and interfaces

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
On this page

HasInventory()#

Code example
HasInventory(item_id: String, character_id: String = "player", amount: int = 1) -> bool

Check an inventory item, owner/route and required amount.

Returns: Boolean.

Code example
HasInventory("key", "player", 1)

Shared versus character-owned inventory settings affect the result.

InventoryCount()#

Code example
InventoryCount(item_id: String, character_id: String = "player") -> int

Count copies of an item for a character/inventory route.

Returns: Integer.

Code example
InventoryCount("key", "player")

CurrentScene()#

Code example
CurrentScene() -> String

Read the active room ID.

Returns: String.

Code example
CurrentScene()

This is a PCA room, not get_tree().current_scene.

Page 73 of 378Permalink
Go to page