Skip to reading
GDScript Programming & Godot

MoveNPCToRoom()

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

Move NPC to a Different Room

Change an NPC's room assignment and arrival position or spawn.

Source table from MoveNPCToRoom(), page 116
Option key / fieldMeaning and inputDefault
Character characterIdChoose a Character Designer ID; player is a runtime alias where supported.Blank
Room sceneIdChoose a scene ID.Blank
Spawn (optional) spawnIdChoose an arrival spawn in the destination scene. May be blank.Blank
XYZ when no spawn positionDestination/placement coordinates as [X, Y, Z].[0.0, 0.0, 0.0]

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

Code example
await MoveNPCToRoom({"characterId": "player", "sceneId": "lab", "spawnId": ""})

In use. Send Elias to the archive after the puzzle. This is a world-state change rather than visible walking between rooms. Confirm that the destination has the intended spawn and that a scene does not already contain a conflicting copy of the NPC.

Page 116 of 378Permalink
Go to page