# TreasureSound.verse
# We define our device class.
# This holds all our logic and device references.
treasure_sound_device := class(creative_device):
# The trigger device detects when a player walks in.
# Assign your TreasureZone trigger device here in UEFN.
@editable
TreasureZone : trigger_device = trigger_device{}
# The audio player device plays our sound cue.
# Assign your Audio Player device here in UEFN.
# Set the sound asset on the Audio Player device itself.
@editable
TreasureAudio : audio_player_device = audio_player_device{}
# OnBegin is the main entry point.
# It runs once when the island loads.
OnBegin<override>()<suspends> : void =
# Connect the trigger's event to our handler function.
# This is like telling the guard: watch the door.
TreasureZone.TriggeredEvent.Subscribe(OnPlayerEntered)
# This function runs when a player enters the zone.
# Agent is the player who triggered the zone.
OnPlayerEntered(Agent : agent) : void =
# Play the sound through the audio player device.
# The audio player device uses the sound asset
# you assigned to it in the UEFN details panel.
Verse Library
verse
02 Device
Plays a sound cue when a player walks into a designated trigger zone.
verse-library/audio/02-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.