Verse Library verse

01 Device

Plays an audio sample when a player steps on a placed trigger device.

verse-library/loading-samples/01-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Concurrency }

# This is our main script. It inherits from creative_device,
# which means it can sit in the world as a placed device.
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.

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.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in