#1 Goal: Stop Your Island’s Soundtrack from Sounding Like a Broken Keyboard
Tutorial beginner

#1 Goal: Stop Your Island’s Soundtrack from Sounding Like a Broken Keyboard

Updated beginner

#1 Goal: Stop Your Island’s Soundtrack from Sounding Like a Broken Keyboard

You know that feeling when you’re deep in a boss fight, the tension is high, and then the background music suddenly shifts from "epic orchestral standoff" to "happy ukulele tutorial"? It breaks the immersion faster than a lag spike.

In Fortnite Creative, this happens because different audio devices (like the Patchwork system) don’t automatically talk to each other. They’re like solo musicians who don’t know the sheet music.

Enter the Music Manager. Think of it as the conductor of your island’s orchestra. It doesn’t make sound itself; instead, it tells every other music device on your island what key to play in, how fast to go, and whether the vibe is major (happy) or minor (sad/serious).

In this tutorial, we’re going to build a Dynamic Combat Atmosphere. We’ll use Verse to create a device that automatically switches the entire island’s music from "Calm Exploration" to "Panic Mode" when enemies spawn. No more manual switching. No more clashing keys. Just pure, synchronized audio chaos.

What You'll Learn

  • The Scene Graph: How devices live in your island and talk to each other.
  • Variables: Storing data (like "Is the boss alive?") so your code remembers what’s happening.
  • Events: Reacting to game moments (like an enemy spawning) without constantly checking.
  • The Music Manager: Controlling the global audio state via Verse.

How It Works

Before we touch any code, let’s look at the hardware (the devices) and the software (the logic).

The Scene Graph: Who’s Who?

In Unreal Engine (and Verse), everything you see on your map is part of a Scene Graph. Imagine a family tree.

  • The Parent: Your Island or a specific Zone.
  • The Children: The devices inside that zone (Spawners, Triggers, Music Managers).

When you write Verse, you’re usually writing a Class. A class is like a blueprint for a custom device. You place this blueprint in your level, and then you fill in the details (like which specific spawner triggers the music).

The Logic: The "Panic Button"

We want a simple loop of cause and effect:

  1. State: We need a way to remember if the "Panic Mode" is currently active. In programming, this is a Boolean Variable (a variable that is either True or False, like a light switch).
  2. Event: We need to know when to flip the switch. We’ll use a Guard Spawner Device. When it spawns an enemy, it fires an event.
  3. Action: When the event fires, our Verse script checks the switch. If it’s off, we turn it on and tell the Music Manager to switch to a minor key and increase the tempo. If it’s on, we turn it off and reset the music.

The Music Manager (M-MGR)

The M-MGR device is the central hub for the Patchwork audio system.

  • Key: The musical scale (e.g., C Major, A Minor). If your sound effects are in C Major, your music must be in C Major or a compatible key, or it will sound dissonant (bad).
  • Tempo: How fast the beat is.
  • Mode: Major (happy/heroic) or Minor (dark/scary).

By controlling the M-MGR via Verse, we ensure that every music device on the island changes at the exact same millisecond.

Let's Build It

We are going to create a Combat Music Switcher.

The Setup (In-Editor):

  1. Place a Music Manager device anywhere in your level. Name it GlobalMusic.
  2. Place a Guard Spawner (this will be your enemy).
  3. Create a Verse Device and attach it to the Guard Spawner (or place it nearby and link them).

The Code:

Here is the Verse script. Copy this into your Verse editor.

using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our custom device blueprint.
# Think of it as a "Smart Music Remote" that we place in the level.
combat_music_switch := class(creative_device):

    # @editable means you can change these settings in the editor panel.
    # It's like the "dials" on a radio.
    
    # The Guard Spawner that triggers the change.
    @editable
    EnemySpawner: guard_spawner_device = guard_spawner_device{}
    
    # The Music Manager we want to control.
    @editable
    MusicController: music_manager_device = music_manager_device{}
    
    # This is our "Light Switch" variable.
    # It starts as False (Calm Mode).
    is_panic_mode: bool = false

    # This function runs when the device is first placed in the world.
    # It's like the "Power On" button for your code.
    OnBegin<override>()<suspends>: void =
        # Subscribe to the spawner's "Spawned" event.
        # This means: "Hey Spawner, tell me every time you make a new enemy."
        EnemySpawner.SpawnedEvent.Subscribe(SpawnHandler)

    # This is the function that runs when the event happens.
    # 'spawner' is the specific spawner that just made an enemy.
    SpawnHandler := func(spawner: guard_spawner_device): void =
        # Toggle our light switch.
        # If it was False, it becomes True. If True, it becomes False.
        is_panic_mode = !is_panic_mode
        
        if (is_panic_mode):
            # PANIC MODE ON
            # Switch to A Minor (scary) and speed up the tempo.
            # We use SetKey and SetTempo to change the global audio state.
            MusicController.SetKey(MusicKey.A_Minor)
            MusicController.SetTempo(120.0) # Faster beats!
            Print("PANIC MODE ACTIVATED: Music is now SCARY.")
        else:
            # CALM MODE ON
            # Switch back to C Major (safe) and slow down.
            MusicController.SetKey(MusicKey.C_Major)
            MusicController.SetTempo(80.0) # Slow, chill beats.
            Print("CALM MODE: Music is now CHILL.")

Walkthrough: What Just Happened?

  1. class(creative_device): We defined a new type of device. This is your Scene Graph entry. It lives in the world.
  2. @editable: These lines created the "dials" you see in the Fortnite Creative editor. You drag your actual Spawner and Music Manager devices into these slots in the UI.
  3. is_panic_mode: bool: This is a Variable. It’s a bucket holding a single piece of data: True or False. We use it to remember if we’re currently in combat or not.
  4. OnBegin: This is an Event. It runs once when the game starts. Its job is to Subscribe to the spawner. Think of it like giving your spawner a walkie-talkie and saying, "Call me when you spawn something."
  5. SpawnHandler: This is the Function (a block of instructions) that runs when the walkie-talkie rings. It flips the boolean variable and calls the Music Manager’s commands.
  6. MusicController.SetKey(...): This is the actual magic. It reaches out to the Patchwork system and changes the global key. Because the Music Manager controls all Patchwork devices, your background music, sound effects, and ambience all shift together.

Try It Yourself

You’ve got the basics, but let’s make it more interesting.

The Challenge: Currently, the music only changes when an enemy spawns. What if you want the music to change back to calm only when the last enemy dies?

Hint:

  1. Look at the guard_spawner_device documentation. Does it have an event for when enemies die? (Look for DeathEvent or similar).
  2. You might need to track the number of enemies alive. Instead of a simple bool (True/False), you’ll need an Integer Variable (a number bucket).
  3. Increment the number when an enemy spawns. Decrement it when an enemy dies.
  4. Only change the music when the number goes from 0 to 1 (first enemy spawns) or from 1 to 0 (last enemy dies).

Don’t worry if you get stuck! The goal is to experiment with how variables hold state.

Recap

  • Scene Graph: Devices are objects in your level that can talk to each other.
  • Variables: Store state (like "is it panic mode?") so your code remembers what’s happening.
  • Events: Let you react to game moments (spawns, deaths) instead of constantly checking.
  • Music Manager: The conductor. Use Verse to change its Key and Tempo to sync your entire island’s audio.

Now go make your island’s soundtrack hit harder than a headshot.

References

  • https://dev.epicgames.com/community/snippets/VgD8/fortnite-ai-music-manager
  • https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-patchwork-music-manager-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite/using-patchwork-music-manager-devices-in-fortnite-creative
  • https://dev.epicgames.com/community/snippets/XPJQ/fortnite-ai-voiceline-manager
  • https://dev.epicgames.com/documentation/en-us/fortnite/fortnite-creative-glossary

Verse source files

Turn this into a guided course

Add fortnite-ai-music-manager 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