Skip to reading
Action Lists & Events

OnSceneLeaving

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page
On this page

GDScript handler: on_scene_leaving(event: Dictionary = {})

The scene-loading route is leaving one scene for another.

Source table from OnSceneLeaving, page 44
Standard contextPractical use / limits
sceneId, nextSceneIdsceneId is the departing room. Do short cleanup here. The normal player Change Scene route also runs its local firstLeave/leave action lists; other loading routes need not reproduce every local transition hook.

OnPlayerChanged#

GDScript handler: on_player_changed(event: Dictionary = {})

The controlled playable character changes.

Source table from OnSceneLeaving, page 44
Standard contextPractical use / limits
playerId, displayNameRefresh character-specific presentation. This event concerns player selection, not every movement of a character. The runtime follows it with OnCharacterControl in the switch path.

OnCharacterControl#

GDScript handler: on_character_control(event: Dictionary = {})

A character becomes the controlled character, including initial control at startup.

Source table from OnSceneLeaving, page 44
Standard contextPractical use / limits
playerId, displayNameUse it for HUD/inventory presentation or control-specific setup. It also has a per-character On Control script hook. This event is a special case in which playerId can identify the calling character for this.

OnItemFound#

GDScript handler: on_item_found(event: Dictionary = {})

The active-inventory add route adds an item that was previously absent from that bag.

Source table from OnSceneLeaving, page 44
Standard contextPractical use / limits
characterId, itemId, amountIt is based on previous possession, not a permanent lifetime discovery log. Remove the last copy and acquire it again, and this route can report it again. Not every NPC/character transfer route emits this event; use a story flag for one-time discoveries.
Page 44 of 189Permalink
Go to page