# Simple Treasure Alert
# All Verse scripts that run on an island must live
# inside a creative_device class.
treasure_alert_device := class(creative_device):
# The trigger device is our zone.
# Assign your TreasureZone device here in UEFN.
@editable
TreasureZone : trigger_device = trigger_device{}
# OnBegin runs once when the game starts.
# It is like turning on the lights.
OnBegin<override>()<suspends> : void =
# Connect to the trigger's TriggeredEvent.
# This happens when an agent enters the zone.
TreasureZone.TriggeredEvent.Subscribe(OnTreasureFound)
# This function runs when a player enters the zone.
# Agent is the player who walked in.
OnTreasureFound(Agent : agent) : void =
# Tell the player they found something.
Print("You found the treasure!")
# In a real script, you would also add:
# TreasureAudio.Play()
# after adding an @editable audio_player_device field above.
# But for now, Print is safe and shows the logic works.
Verse Library
verse
03 Device
Listens for player entry in a trigger zone and executes a custom response function.
verse-library/audio/03-device.verse