The "Boss Music" Trap: Automating Victory Fanfares with Verse
Tutorial beginner compiles

The "Boss Music" Trap: Automating Victory Fanfares with Verse

Updated beginner Code verified

The "Boss Music" Trap: Automating Victory Fanfares with Verse

You know that feeling when you finally wipe out a whole squad, or when you solo a boss in a creative mode, and the game just knows? The music swells, the lights flash, and the universe celebrates your dominance. Usually, that's just the game's default UI doing its job. But what if you could make the actual world react? What if, every time a player hit a 5-kill streak, the arena itself erupted in a custom playlist that only played for the victors?

In this tutorial, we're building an Elimination Streak Radio. We're going to use Verse to watch for eliminations, count them up like a scoreboard, and trigger a specific audio track the moment a player hits a specific number. No more manual button pressing. No more broken logic. Just pure, automated hype.

What You'll Learn

  • Variables: How to store a changing number (like a kill count) in memory.
  • Events: How to listen for in-game actions (like an elimination) without constantly checking.
  • Conditionals: How to make the game make decisions ("If 5 kills, then play music").
  • Scene Graph Basics: Understanding how your Verse script connects to physical devices in the editor.

How It Works

Think of Verse like the Elimination Manager device, but with superpowers. The Elimination Manager is great for simple stuff, but it's rigid. Verse lets you build custom logic.

Here is the game mechanic analogy: Imagine you are the Referee of a fighting game.

  1. The Variable: You have a notepad (a variable) where you write down the current combo count. Every time a fighter lands a hit, you add 1 to that number.
  2. The Event: You don't stare at the fighters 24/7. You wait for the sound of a hit connecting. In Verse, this is an "Event." It's like a motion sensor that only turns on when something specific happens.
  3. The Conditional: You look at your notepad. Is the number 5? If yes, you blow the whistle and hit the "Victory Music" button. If no, you keep watching.

In our scene, we have a Radio device playing music. We have an Elimination Manager (or similar logic) tracking kills. We need a Verse script that sits in the middle, watches the kill count, and yells at the Radio to start playing when the count hits our target.

Let's Build It

We need three things in your UEFN editor:

  1. A Radio device (set to your favorite hype track).
  2. A way to track eliminations. For this tutorial, we'll use a Tracker device set to count eliminations on Channel 30.
  3. A Verse Script that reads the Tracker and controls the Radio.

The Verse Code

Create a new Verse file in your project. Paste this in. Don't worry about the weird symbols yet; we'll break them down.

# This is the blueprint for our "Streak Observer"
# Think of this as the Referee's Notepad and Whistle combined
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We create a "class" marked as a creative_device — this makes it
# show up in the UEFN editor so you can drag devices into its properties.
# Think of it as a backpack that holds two things: the Kill Count and the Radio.
streak_observer := class(creative_device):

    # The Radio Device we want to control.
    # In the editor, you will drag your Radio device here.
    @editable
    Radio : radio_device = radio_device{}

    # The Tracker Device counting the kills.
    # In the editor, you will drag your Tracker device here.
    @editable
    KillTracker : tracker_device = tracker_device{}

    # This is our "Variable" - a number that changes.
    # We use 'var' so Verse lets us reassign it later.
    # We start at 0.
    var CurrentStreak : int = 0

    # This is the target number.
    # Set this to whatever streak you want (e.g., 5 for a 5-kill streak).
    @editable
    TargetStreak : int = 5

    # OnBegin is called when the game starts.
    # It's like the "Start Game" button.
    # It is 'suspends' because Verse devices run their startup logic as async tasks.
    OnBegin<override>()<suspends> : void =
        # We want to listen for updates from the Tracker.
        # The Tracker fires CompleteEvent whenever its tracked value reaches the target.
        # We connect our "OnKillEvent" function to that event.
        KillTracker.CompleteEvent.Subscribe(OnKillEvent)

    # This is the "Event" listener.
    # It doesn't run continuously. It only runs when the Tracker sends a signal.
    # Think of it as a doorbell. You only answer when it rings.
    # CompleteEvent passes the agent who triggered the change.
    OnKillEvent(Agent : agent) : void =
        # Increment our internal variable by 1 each time an elimination fires.
        set CurrentStreak += 1

        # This is the "Conditional" (The If/Else statement).
        # "If CurrentStreak is exactly equal to TargetStreak..."
        if (CurrentStreak = TargetStreak):
            # ...Then Play the Radio!
            # We tell the Radio device to start playing its audio.
            Radio.Play()

            # Reset the streak so the fanfare can trigger again next round.
            set CurrentStreak = 0```

### Walkthrough: What Just Happened?

1.  **`streak_observer := class(creative_device)`**: This defines our script. It's a class that can initialize itself when the map loads.
2.  **`@editable Radio : radio_device` & `@editable KillTracker : tracker_device`**: These are **Properties**. The `@editable` attribute exposes them as empty slots in the UEFN editor, waiting for you to drag devices into them. This is how Verse talks to the physical world.
3.  **`var CurrentStreak : int = 0`**: This is your **Variable**. `int` means "integer" (a whole number). The `var` keyword means the value can change at runtime. It starts at 0.
4.  **`KillTracker.ScoreChangedEvent.Subscribe(OnKillEvent)`**: This is the magic. We are subscribing to an event. When the Tracker's score changes (because a kill happened), it automatically calls the `OnKillEvent` function.
5.  **`if (CurrentStreak = TargetStreak):`**: This is the **Conditional**. In Verse, a single `=` inside an `if` is a *failable equality check*  it succeeds only when both sides match. If it does, it executes the code indented beneath it.
6.  **`Radio.Play()`**: This tells the Radio device to start playing.

## Try It Yourself

You've got the code, but you need to connect it to the editor.

**The Challenge:**
1.  Place a **Radio** device in your map. Set it to a song you like.
2.  Place a **Tracker** device. Set it to count **Eliminations** (you may need to link it to an Elimination Manager or Creature Spawner that sends signals on Channel 30).
3.  Place a **Verse Script** device.
4.  **The Hard Part:** In the Verse Script's details panel, you need to drag your *Radio* device into the `Radio` slot and your *Tracker* device into the `KillTracker` slot.
5.  **The Twist:** Change the `TargetStreak` variable in the script to `3`. Now, the music should play after every 3rd kill.

**Hint:** If the music doesn't play, check two things:
1.  Did you set the Tracker to send signals on Channel 30?
2.  Did you actually drag the devices into the Verse Script's properties in the editor? (Verse doesn't guess; you have to hand it the devices!)

## Recap

You just built a dynamic event system. You learned that:
*   **Variables** store changing data (like the current kill count).
*   **Events** let your code react to specific moments (like a kill happening) instead of constantly checking.
*   **Conditionals** let you make decisions (if kills == 5, play music).
*   **The Scene Graph** connects your code to the physical devices in your level.

Next time you're in a match and the boss music kicks in, you'll know exactly who's responsible. And now, it's you.

## References

*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-radio-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/accolades-device-gameplay-examples-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/fortnite-glossary
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/fortnite-creative-glossary
*   https://dev.epicgames.com/documentation/en-us/uefn/team-elimination-game-5-granting-weapons-on-eliminations-in-verse

Verse source files

Turn this into a guided course

Add Elimination Streak Radio 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