The Loot Goblin’s Playlist: Loading Samples in Verse
verse-library
scream_trap_device := class(creative_device):
# This is our 'Backpack' (Component) that will hold the audio.
# audio_player_device is a real UEFN device you place on your island
# and wire up in the editor. It wraps your imported sound asset.
# Drag an Audio Player Device from the device list onto your island,
# then assign it to this slot in the Verse Device details panel.
@editable
AudioPlayer : audio_player_device = audio_player_device{}
# This is our trigger — the pressure plate the player walks over.
# Place a Trigger Device on your island and assign it here.
@editable
Trap : trigger_device = trigger_device{}
# This function runs ONCE when the island starts.
# Think of this as the 'Pre-Match Lobby' phase.
OnBegin<override>()<suspends> : void =
# Subscribe to the trigger's TriggeredEvent.
# Whenever a player steps on the Trap, TriggerSound is called.
# This is like the Bus picking up the playlist before the drop.
Trap.TriggeredEvent.Subscribe(OnTrapped)
# This function runs when a player steps on the trigger.
# The agent parameter is the player who activated the trap.
OnTrapped(Agent : ?agent) : void =
# Tell the AudioPlayer device to play its assigned sound asset.
# The sound asset itself is configured on the audio_player_device
# in the UEFN editor — set it to your imported ScreamSample there.
# This is the 'Drop'. Instant playback.
AudioPlayer.Play()