Make Your Island Dance with Verse and Drum Beats
Tutorial beginner compiles

Make Your Island Dance with Verse and Drum Beats

Updated beginner Code verified

Make Your Island Dance with Verse and Drum Beats

Do you want your Fortnite island to have its own rhythm? You can make drums beat when players jump or shoot! This is not just background music. It is interactive sound. You will use Verse to control a special device called the Drum Player.

You will learn how to connect a trigger to a drum. You will hear a beat every time a player presses a button. This makes your island feel alive. Let's make some noise!

What You'll Learn

  • What a Device is in Verse.
  • How to use a Trigger to start a sound.
  • How to connect devices using Cables.
  • How to make a drum beat on command.

How It Works

Think of your island like a giant toy train set. Each device is a train car. The cars need to be connected with tracks (cables). When the first car moves, it pulls the next one.

In our game, we have two main cars:

  1. The Trigger: This is like a pressure plate. When a player steps on it, it sends a signal.
  2. The Drum Player: This is the music maker. It takes the signal and plays a drum sound.

We need to connect the Trigger to the Drum Player. In Verse, we do this by writing code that tells the Trigger to "fire" the Drum Player.

Let's Build It

First, go to the Creative inventory. Search for "Patchwork." Find the Drum Player device. Place it on your island. Next, find a Trigger device. Place it near the Drum Player.

Now, open the Verse script editor. We will write a simple script. This script connects the two devices.

# This is our main script file
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We define a new script type called DrumBeat
DrumBeat := class(creative_device) {
    # Here we list the devices we need
    # "MyTrigger" is the name we give to the trigger device
    @editable
    MyTrigger : trigger_device = trigger_device{}
    # "MyDrum" is the name we give to the Drum Player device
    @editable
    MyDrum : Patchwork.drum_player_device = Patchwork.drum_player_device{}

    # This function runs when the game starts
    OnBegin<override>()<suspends> : void = {
        # We listen for the trigger to be pressed
        # When it happens, we play the drum
        MyTrigger.TriggeredEvent.Subscribe(OnTriggered)
    }

    # This function is called when the trigger fires
    OnTriggered(Agent : ?agent) : void = {
        # This line tells the drum to enable (play)
        # note: drum_player_device inherits Enable() from patchwork_device
        MyDrum.Enable()
    }
}```

Let's look at the important parts.

`patchwork_drum_player_device` is a special word. It tells Verse that `MyDrum` is a music maker. It is not just a box. It can make sounds.

`trigger_device` is another special word. It tells Verse that `MyTrigger` is a button or plate. It waits for someone to press it.

`PlayNote` is the action. It makes the sound. The number `60` is the MIDI note (which drum sound to play) and `1.0` is the velocity (how hard it hits, from `0.0` to `1.0`). You can change them later.

## Try It Yourself

Can you make the drum play a different sound? Try changing the numbers in `PlayNote`. Or, try adding a second trigger. Make one trigger play a kick drum. Make another trigger play a snare.

Hint: Look at the Drum Player device options. You can change the drum type there. But the Verse code tells it *when* to play.

## Recap

You built a simple drum machine with Verse. You connected a trigger to a drum player. Now your island has a beat! You can make games where sound reacts to players. This is just the start. You can add more devices and more complex rhythms. Have fun making noise!

## References

*   https://dev.epicgames.com/documentation/en-us/fortnite/using-patchwork-drum-player-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-patchwork-drum-player-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/using-patchwork-note-trigger-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-patchwork-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/using-patchwork-drum-sequencer-devices-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-patchwork-drum-player-devices-in-fortnite-creative to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

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