Solo Queue: How to Test Your Elimination Code with Sentinels
Tutorial beginner

Solo Queue: How to Test Your Elimination Code with Sentinels

Updated beginner

Solo Queue: How to Test Your Elimination Code with Sentinels

Testing multiplayer code in Fortnite Creative is a pain. You need other people, you need to coordinate schedules, and half the time your friends just want to build a mega-base instead of testing your logic. Enter the Sentry Device. Think of it as your personal, AI-controlled dummy that doesn’t complain when you shoot it and actually triggers your code when it dies. In this tutorial, we’ll teach you how to use Verse to listen for when a Sentry gets eliminated, treating it exactly like a player so you can test your weapon-granting and scoring logic without needing a squad.

What You'll Learn

  • The Problem with Solo Testing: Why you can’t just shoot a random prop and expect your code to fire.
  • Event Subscription: How to tell Verse, "Hey, call this function when this specific thing dies."
  • The ?agent Optional Type: Understanding why some data might be missing (like when a bot dies) and how to handle it safely.
  • Building a Test Loop: Creating a simple system where killing a Sentry grants you a weapon, proving your multiplayer logic works in single-player.

How It Works

The "Dummy" Problem

In a normal Team Elimination game, you have Players and Enemies. When a Player eliminates an Enemy, Verse fires an event. But if you are playing alone, you have no Enemies. If you shoot a rock, nothing happens because rocks don’t have "elimination code" attached to them. They’re just rocks.

To fix this, UEFN gives us the Sentry Device. A Sentry is a prop that acts like a player. It has health, it can be killed, and most importantly, it has an EliminatedEvent.

Events: The "Ding Dong" of Programming

An Event is like a doorbell. You don’t walk around the house checking if someone is at the door every second. You wait for the ding-dong (the event) to happen. In Verse, we don’t constantly check "Is the Sentry dead?" Instead, we Subscribe to the Sentry’s EliminatedEvent.

Subscribe means: "Register my function to be called automatically when this event happens."

The ?agent Mystery

When a player eliminates an enemy, Verse knows exactly who did it. It passes that player’s data to your function. But when a Sentry dies? It might be killed by a trap, a storm, or a glitch. Verse still wants to tell you it died, but it might not know who did it.

In programming, we use a Optional Type (written as ?) to handle this uncertainty. It’s like a loot drop that might contain a Legendary, or it might just be a common material. You have to check if the item is there before you try to equip it, or your character will glitch out.

Let's Build It

We are going to create a simple script that listens for Sentry eliminations. When a Sentry dies, we’ll print a message to the debug log. Later, you can replace that print statement with code that grants you a weapon.

Step 1: The Setup

  1. Place a Sentry Device in your level. Let's call it TestSentry.
  2. Create a Verse File in your project folder.
  3. Open it in Visual Studio Code.

Step 2: The Code

Here is the complete, annotated Verse script.

# We need to access the core Fortnite systems
use FortniteGameVerse://

# This is our main "Game Class". Think of it as the brain of your island.
# It holds all the variables and functions for your game mode.
team_elimination_game = class(Game):

    # This is a "Function". It’s a block of code that does a specific job.
    # We will call this function whenever a Sentry is eliminated.
    # The `?agent` part means "The person who killed the Sentry, IF there was one."
    # It's optional because sometimes traps kill sentries, and traps aren't players.
    TestPlayerEliminated(Agent : ?agent) : void =
        # This checks if 'Agent' actually has a value (is not empty).
        # If a player killed the sentry, Agent will have data.
        # If a trap killed it, Agent will be empty (None).
        if Agent != None:
            # Print is like the in-game chat log, but only for developers.
            # It helps us debug without cluttering the player screen.
            Print("Sentry Down! Player eliminated it.")
        else:
            Print("Sentry Down! Trap or glitch eliminated it.")

    # This function runs once when the game starts.
    Initialize() : void =
        # Get the specific Sentry device we placed in the editor.
        # You must name your Sentry device in the editor to match this string.
        sentry := GetEntity("TestSentry")

        # HERE IS THE MAGIC:
        # We subscribe to the Sentry's EliminatedEvent.
        # Whenever the sentry dies, Verse automatically calls TestPlayerEliminated.
        # We pass our function name as the "listener".
        sentry.EliminatedEvent.Subscribe(TestPlayerEliminated)

Walkthrough: What Just Happened?

  1. GetEntity("TestSentry"): This grabs the physical Sentry device from your level. Imagine grabbing a specific remote control out of a pile of remotes.
  2. .Subscribe(TestPlayerEliminated): This is the most important line. It ties the physical event (Sentry dying) to your code function.
  3. if Agent != None: This is safe coding. If we tried to print the player's name when Agent was empty, the game would crash (blue screen of death). By checking first, we stay safe.

Try It Yourself

Now that you have the basic listener working, let’s make it actually useful.

The Challenge: Modify the code above so that when a player eliminates the Sentry, they get a Shotgun.

Hint:

  1. You’ll need to use the GrantWeapon function. Look up how to grant a weapon to an agent in the Verse documentation.
  2. Remember: You can only grant a weapon if Agent is not None. If a trap killed the sentry, don’t grant a weapon (or you’ll crash the game trying to give a gun to a trap).
  3. The function signature for granting a weapon usually looks like: GrantWeapon(Agent, WeaponType).

Solution Hint:

Recap

  • Sentry Devices are your best friend for solo testing. They act like players but don’t require a lobby.
  • Events let you react to things happening in the game without constantly checking.
  • Subscribing connects a game event (like a death) to your code.
  • Optional Types (?) protect your code from crashing when data is missing.

Now you can test your elimination logic, weapon grants, and score systems without begging your friends to log in. Happy coding, and may your sentries fall often.

References

  • https://dev.epicgames.com/documentation/en-us/fortnite/team-elimination-7-testing-multiplayer-using-the-sentry-device-in-verse
  • https://dev.epicgames.com/documentation/en-us/fortnite/team-elimination-game-in-verse
  • https://dev.epicgames.com/documentation/en-us/fortnite/team-elimination-1-setting-up-the-level-in-verse
  • https://dev.epicgames.com/documentation/en-us/fortnite/team-elimination-6-handling-a-player-joining-a-game-in-progress-in-verse
  • https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse

Get the complete code — free

You've read the full walkthrough. The complete, copy-paste-ready Verse solution is free for members — sign in to unlock it.

Free with your BrainDead.TV / BrainDeadGuild Discord account. The walkthrough above is always free.

Verse source files

Turn this into a guided course

Add team-elimination-7-testing-multiplayer-using-the-sentry-device-in-verse 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