23. React when a finite clip finishes
The typed GUI Events tab has pointer events, not a dedicated On Video Finished action slot. A script can wait for the embedded player’s natural finished signal. Create a Boolean variable clip_done, starting false:
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
var player := GetGUIElementProperty(
"video_lab", "briefing_video", "video_player", null
) as VideoStreamPlayer
if player == null or player.stream == null:
return false
await SetVariable({"name": "clip_done", "value": false})
player.loop = false
player.paused = false
player.play()
await player.finished
await SetVariable({"name": "clip_done", "value": true})
return trueRun this from a Play once Button and let the short clip reach its end. You can then place the intended story action after the wait, or test clip_done elsewhere.
Loop is deliberately turned off so the exercise has a natural end. A stop or close is not the same event as reaching that end. If the player can cancel, give the cancel path its own cleanup and result rather than assuming finished ran.
Do not start several copies of the waiting script for one playback. In a finished interface, guard the launch or disable repeated activation while that sequence is active.
