Skip to reading
GDScript Programming & Godot

OnItemFound

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

Earlier edition reference / Current 0.86.4.0 property paths > p. 350

Code example
func on_item_found(event: Dictionary = {}) -> void:
    Log(ToJSON(event))

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

Source table from OnItemFound, page 297
Common contextUse and 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.

OnVideoEnd#

Code example
func on_video_end(event: Dictionary = {}) -> void:
    Log(ToJSON(event))

The runtime receives the video-finished callback.

Source table from OnItemFound, page 297
Common contextUse and limits
videoAssetIdFilter the asset ID. Do not assume an explicit Stop Video or an interrupted/looping clip has the same natural-end behavior. Dedicated On Video End graph nodes are an additional entry route; avoid duplicating the same reward in both routes.

OnMusicEnd#

Code example
func on_music_end(event: Dictionary = {}) -> void:
    Log(ToJSON(event))

The music-finished callback reaches the runtime.

Source table from OnItemFound, page 297
Common contextUse and limits
musicAssetIdUse a non-looping track when testing. Stopping or replacing a track is not the same as natural completion. Dedicated On Music End graph nodes can also listen for a selected asset.
Page 297 of 378Permalink
Go to page