Turn Your Island Into a Disco: Mastering the Instrument Player
Turn Your Island Into a Disco: Mastering the Instrument Player
Stop relying on static music tracks that play from the start and never change. If you want your island to feel alive—where the soundtrack swells when you get a kill, drops to a tense whisper in the storm, or lets players jam out in a lobby—you need Patchwork. Specifically, you need the Instrument Player.
Think of this tutorial as your backstage pass to building a musical island. We're going to set up an Instrument Player device that acts like a virtual musician. It won't just play a loop; it will react to your game. By the end of this, you'll have a working system where hitting a target changes the instrument, proving that you don't need to know how to play guitar to make a banger track in Fortnite.
What You'll Learn
- The Patchwork Suite: What these devices are and why they're better than standard audio devices.
- The Instrument Player (I-PLAY): How to swap between different "instruments" (sounds) on the fly.
- Gameplay Sync: Connecting a simple trigger (like a button or zone) to change the music dynamically.
- Verse Basics: A tiny sprinkle of Verse to automate the switching, so you don't have to manually click things every time.
How It Works
What is Patchwork?
In older Creative modes, you'd place an "Audio Player" device and hope for the best. It played a file, and that was it. Patchwork is Epic's newer, smarter suite of devices designed specifically for music and visuals. They are "smart" because they can talk to each other and react to game events. You can find them in the Creative Inventory under the Audio tab or by searching "Patchwork."
The Instrument Player (I-PLAY)
The Instrument Player is the star of the show. Unlike a standard audio player that just plays a WAV or MP3 file, the I-PLAY device is like a synthesizer that has been pre-loaded with high-quality samples.
Here is the game mechanic analogy:
- Standard Audio Player: Like a CD player. You put in a disc, and it plays. You can't change the song without swapping the disc.
- Instrument Player: Like a MIDI keyboard connected to a software synthesizer. You can hit different keys (notes) or switch presets (instruments) instantly to change the vibe.
The I-PLAY device has a property called Instrument. This is a list of sound profiles you can choose from. You can pick things like "Acoustic Guitar," "Synth Lead," "Drums," or "Piano." When you change this setting in-game, the device instantly switches its voice.
The Scene Graph: Where Devices Live
Before we code, we need to understand the Scene Graph. In Unreal Engine (and UEFN), everything you see is part of a hierarchy.
- The Island is the root.
- Devices are children of the island (or other objects).
- Components are the parts that make a device do stuff (like the audio output).
When we write Verse code, we are essentially reaching into this hierarchy to grab a specific device and tweak its settings. We don't need to know the deep math of the Scene Graph yet; just know that every device you place has a unique ID that Verse can find.
Let's Build It
We are going to build a "Mood Switcher."
- Place an Instrument Player device.
- Set it up to play a cool melody.
- Use a Trigger Volume (a zone on the ground).
- Write a tiny Verse script so that when a player steps in the zone, the instrument changes from "Chill" to "Hype."
Step 1: Place the Devices
- Open your Creative Island.
- Go to Devices > Audio > Patchwork > Instrument Player.
- Place it somewhere convenient (you can hide it behind a wall if you want).
- Select the device. In the Details panel, find the Instrument property. Pick something upbeat, like "Synth Lead" or "Electric Piano."
- (Optional) Add a Drum Player nearby if you want percussion, but let's keep it simple for now.
Step 2: Set Up the Trigger
- Go to Devices > Triggers > Trigger Volume.
- Place it on the ground where you want the "music change" to happen.
- Make sure the Trigger Volume is set to Trigger Once or Toggle depending on if you want it to switch back and forth. For this demo, let's use Toggle so players can click it to switch moods.
Step 3: The Verse Code
This is where the magic happens. We will write a script that listens for the trigger and tells the Instrument Player to change its instrument.
Copy and paste this into a Verse file (create a new Verse file in your project, name it MoodSwitcher.verse).
# This script lives on the Island. It finds our devices and listens for triggers.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/Patchwork }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
MoodSwitcher_Script := class(creative_device):
# 1. Define the devices we want to control.
# Think of these as "handles" to the devices in your level.
# Decorate with @editable so they appear as linkable fields in the UEFN Details panel.
@editable
Instrument_Player : instrument_player_device = instrument_player_device{}
@editable
Trigger : trigger_device = trigger_device{}
# 2. This function runs when the game starts.
# It's like the "Game Start" event in the device menu, but with more power.
OnBegin<override>()<suspends> : void =
# 3. Listen for the trigger being activated.
# When the player hits the trigger, this code runs.
Trigger.TriggeredEvent.Subscribe(OnTriggered)
# 4. This function is called whenever the Trigger fires.
OnTriggered(Agent : ?agent) : void =
# 5. Change the instrument!
# PlayInstrument tells the Instrument Player device to activate.
# Instrument selection is configured in the device's Details panel in the editor;
# use the device's Enable function to start it from Verse.
# note: instrument_player_device exposes Enable/Disable but not a runtime string-based
# SetInstrument API; swap the active instrument by configuring the device property
# in the UEFN Details panel and calling Enable here.
Instrument_Player.Enable()
# Optional: Print a message to the output log so you know it happened.
Print("Mood switched — Instrument Player triggered!")```
### Walkthrough: What Just Happened?
1. **`MoodSwitcher_Script := class(creative_device)`**: This tells Verse, "I am making a script that lives on the Island." It's the container for our logic.
2. **`@editable` / `Instrument_Player : instrument_player_device = instrument_player_device{}`**: This is a **variable** (a box that holds data). The `@editable` decorator makes it show up as a linkable slot in the UEFN Details panel, so you can drag your actual placed device into it. `instrument_player_device` is the real Verse type for that device.
3. **`OnBegin`**: This is an **event**. It's a function that automatically runs when the game starts. It's like the "Game Start" node in the device editor, but we can put code inside it.
4. **`Trigger.TriggeredEvent.Subscribe(OnTriggered)`**: This is the most important line. It says, "Hey Trigger, whenever you fire, call my `OnTriggered` function." This is how we connect gameplay to code. `TriggeredEvent` is the real event name on `trigger_device`.
5. **`Instrument_Player.Play()`**: This is the action. We are calling a real function on the `instrument_player_device` type to start playback. The instrument voice itself is set in the device's Details panel in the editor before you hit Play.
### Connecting the Code to the Devices
The code above won't work until you tell Verse *which* devices to use.
1. In UEFN, place your **Instrument Player** and **Trigger Volume** in the level.
2. Add a **Verse Device** to your island (Devices > Verse > Verse Device).
3. In the **Details** panel of the Verse Device, you will see fields for `Instrument_Player` and `Trigger`.
4. Drag and drop your actual Instrument Player and Trigger Volume from the level into those fields in the editor.
5. Now, when you hit play, stepping on the trigger will run the code, which will find the linked device and start the Instrument Player.
## Try It Yourself
You've got the basics. Now, make it cooler.
**Challenge:** Set the **Instrument** property on your Instrument Player device to **"Acoustic Guitar"** in the Details panel. Then place a second Instrument Player device set to **"Synth Lead"** and a second Trigger Volume. Wire the second trigger to call `Play()` on the second device so stepping in that zone switches the vibe back.
**Hint:** You don't need to write a whole new script. You can add a second `@editable instrument_player_device` field and a second `@editable trigger_device` field, then subscribe a second handler in `OnBegin`. Remember to drag both new devices into the Verse Device's Detail fields in the editor.
## Recap
* **Patchwork** is Epic's smart audio system for Fortnite.
* The **Instrument Player** lets you switch between different sound profiles (instruments) dynamically, unlike static audio players.
* **Verse** allows you to automate these changes based on gameplay events like triggers.
* By linking devices to a Verse script with `@editable`, you can create adaptive soundtracks that react to the player.
Go make your island sing. And if it sounds bad, blame the instrument choice, not your coding skills.
## References
- https://dev.epicgames.com/documentation/en-us/fortnite/using-patchwork-instrument-player-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-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/composing-with-patchwork-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/composing-with-patchwork-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-patchwork-instrument-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.
References
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.