# This is a simple Verse script for a respawnable coin
# We define the 'Coin' as an object that has a Timer and a Respawn function
# First, we need to import the tools we need
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
# This is our main 'Actor' (think of it as the Coin's brain)
# creative_device is the real base class for UEFN Verse devices
respawnable_coin := class(creative_device):
# These are our 'Variables' - things that can change
# A variable is like a loot box: it holds an item, and you can swap the item inside.
# These @editable fields appear as slots in the UEFN details panel,
# where you drag in your real Timer and Coin devices from the scene.
@editable
TimerDevice : timer_device = timer_device{}
@editable
CoinDevice : item_spawner_device = item_spawner_device{}
# This is the 'Event' that runs when the game starts
# OnBegin is the real UEFN lifecycle function; it is async because it can Await
OnBegin<override>()<suspends> : void =
# Here we 'Bind' the devices together in code.
# Subscribe() is how Verse attaches a callback to a listenable event.
# We tell the CoinDevice: "When you are collected, run StartTimerOnCollect."
CoinDevice.ItemPickedUpEvent.Subscribe(StartTimerOnCollect)
Verse Library
verse
01 Device
Wires a timer and item spawner to automatically respawn collected coins after a set delay.
verse-library/bind-timers-and-coins/01-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.