Verse Library verse

01 Device

Starts and loops a drum sequencer on island begin, using editor-configured audio routing.

verse-library/using-patchwork-drum-sequencer-devices-in-fortnite-creative/01-device.verse

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

# This is our main script.
# It runs when the island starts.
# note: In UEFN, device references are declared as editable properties
# on a creative_device class, not fetched by name at runtime.
# Wire your DrumSequencer, DrumPlayer, and Speaker in the editor UI.
drum_booth_manager := class(creative_device):

    @editable
    Sequencer : drum_sequencer_device = drum_sequencer_device{}

    @editable
    Player : drum_player_device = drum_player_device{}

    # note: Patchwork audio routing (Output.Connect) is done via editor
    # cable connections, not Verse API calls. OnBegin starts playback.
    OnBegin<override>()<suspends> : void =
        # Start the sequencer so it loops forever.
        # The editor cables already route audio to the drum player.
        Sequencer.Enable()

Comments

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