Random spot ambience in Verse
Spot sounds are what stop an ambience feeling like a loop: a distant call, a creak, something moving. Here is a small device that plays a random audio player from a list at random intervals. It's the Verse version of a Blueprint timer with a random delay.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
# Plays a random audio player from a list, at random intervals.
spot_ambience_device := class(creative_device):
# Drag your audio player devices into this list in the Details panel
@editable
Spots : []audio_player_device = array{}
@editable
MinDelay : float = 4.0
@editable
MaxDelay : float = 12.0
OnBegin<override>()<suspends> : void =
loop:
Sleep(GetRandomFloat(MinDelay, MaxDelay))
# Guard against an empty list before picking an index
if (Spots.Length > 0, Index := GetRandomInt(0, Spots.Length - 1), Spot := Spots[Index]):
Spot.Play()
What it shows
@editablefields appear in the Details panel, so a level designer can swap sounds and change timings without opening the code.loop:withSleep()does the job of a Blueprint timer, and runs as a single readable block.- The
ifguard handles an empty list, because picking from nothing is a runtime failure.
Next: weighting the spots, so rarer sounds fire less often, and keeping the same sound from playing twice in a row.
Note: a sketch written to show the shape of the approach. Check device and function names against the Verse API reference for your UEFN version before using it.