The Round-Start Trigger: How to Make Your Island Wake Up When the Match Begins
The Round-Start Trigger: How to Make Your Island Wake Up When the Match Begins
You’ve built the ultimate Battle Royale arena. You have the loot, the traps, the storm. But right now, your island is sleeping. It doesn’t know when the match starts, and it doesn’t know when it’s over. That’s where SubscribeRoundStarted comes in.
Think of this function as the "Match Start" signal that tells your Verse code to wake up and start doing its job. Without it, your custom mechanics sit idle until a player manually triggers something. With it, your island reacts automatically the moment the Battle Bus pops.
What You'll Learn
- What a "Round" is in Fortnite’s backend and why it matters to your code.
- How to use
SubscribeRoundStartedto trigger actions exactly when the match begins. - How to handle the "cleanup" phase when the round ends using
SubscribeRoundEnded. - How to structure your Verse code so it doesn’t crash when the game resets.
How It Works
In Fortnite, a "Round" is basically the entire life of a match. It starts when the players spawn in the lobby or drop from the bus, and it ends when the last player is eliminated or the timer runs out.
In Verse, you don’t just write code that runs once and dies. You need to tell your code: "Hey, when the round starts, do this. When it ends, clean up."
This is where Callbacks come in. A callback is like a promise you make to the game engine. You say, "When Round Start happens, please call this specific function." The engine holds that promise. When the match starts, it keeps its word and runs your function.
Why Subscribe?
Imagine you’re building a "Loot Goblin" island. Every time a new round starts, you want the goblin to spawn in a random spot. If you don’t subscribe to the round start event, the goblin will only spawn if you manually hit "Play" in the editor, and it won’t respawn when the next match begins. By subscribing, you ensure your logic is tied to the game’s lifecycle, not just your playtesting session.
The "Cancel Handle"
When you subscribe, the game gives you a "handle." Think of this like a remote control for your subscription. It’s not strictly necessary for a simple tutorial, but it’s good practice. If you want to stop your code from listening (maybe to pause the game), you use that handle to cancel the subscription. For now, we’ll just keep it simple: we subscribe, and we let the game handle the rest.
Let's Build It
We’re going to build a simple "Match Status Display." When the round starts, a text prop will change to say "MATCH STARTED." When it ends, it will say "MATCH OVER." This is a foundational pattern for almost any custom game mode.
The Setup
- Open UEFN.
- Create a new Verse Script.
- Place a Text Prop in your world. Name it
StatusDisplay. - In the Verse script, we’ll use
Entity.GetFortRoundManagerto find the game manager, then subscribe to the start and end events.
The Code
using { /Fortnite.com/Game }
# This is our main script. Think of it as the "Brain" of our island.
script MatchStatusController: VerseScript()
# We need a reference to our Text Prop so we can change its text.
# In Verse, we bind this in the editor, but for this example,
# we'll assume we have a way to access it.
# Note: In a real script, you'd typically get the entity by name or reference.
StatusTextProp: TextProp = TextProp{}
# This function runs when the round STARTS.
# It's our "Callback" - the promise we made to the game engine.
OnRoundStart(): void =
# Change the text to show the match has begun.
StatusTextProp.SetText("MATCH STARTED!")
# You could also play a sound, spawn loot, etc. here.
print("Round has started! The game is live.")
# This function runs when the round ENDS.
OnRoundEnd(): void =
# Change the text to show the match is over.
StatusTextProp.SetText("MATCH OVER")
print("Round has ended. Cleaning up...")
# This is where we set up our subscriptions.
# It runs once when the script initializes.
OnBeginScript(): void =
# First, we need to find the Round Manager.
# Think of this as finding the "Referee" of the match.
if (RoundManager := Entity.GetFortRoundManager[]):
# Subscribe to the Round Start event.
# We pass our OnRoundStart function as the callback.
# The game will call OnRoundStart() when the round begins.
RoundManager.SubscribeRoundStarted(OnRoundStart)
# Subscribe to the Round End event.
# We pass our OnRoundEnd function as the callback.
RoundManager.SubscribeRoundEnded(OnRoundEnd)
print("Subscribed to round events. Waiting for match to start...")
else:
print("Error: Could not find Round Manager.")
Walkthrough
using { /Fortnite.com/Game }: This line tells Verse, "I need access to Fortnite-specific game logic, like rounds and players."script MatchStatusController: This defines our script. It’s like creating a new class of object.OnRoundStart(): This is our callback. When the round starts, the engine looks for this function and runs it. We simply change the text of our prop.OnRoundEnd(): Same idea, but for when the match ends.OnBeginScript(): This is where the magic happens. We get theRoundManager(the referee). Then, we callSubscribeRoundStarted(OnRoundStart). This is the critical line. It tells the engine: "Hey, when the round starts, please run theOnRoundStartfunction."
Try It Yourself
Now that you have the basics, try to expand this.
Challenge: Add a "Loot Drop" feature. When the round starts, instead of just changing text, make a Prop Mover move a chest from underground to the surface.
Hint: You’ll need to:
- Find your Prop Mover in the script (use
Entity.GetByNameor similar). - In
OnRoundStart, call the Prop Mover’sActivatefunction or set itsTargetLocation. - Remember, you might need to reset the Prop Mover in
OnRoundEndso it’s ready for the next match!
Recap
SubscribeRoundStartedis your way of telling Verse to listen for the match start signal.- You create a callback function (like
OnRoundStart) that contains the code you want to run. - You pass that function to the
RoundManagerto register it. - Always remember to handle the round end event to clean up or reset your mechanics for the next match.
References
- https://dev.epicgames.com/documentation/en-us/fortnite/interactable-components
- https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/fortnitedotcom/game/fort_round_manager/subscriberoundstarted
- https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/fortnitedotcom/game/fort_round_manager
- https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/fortnitedotcom/game/fort_round_manager/subscriberoundended
- https://dev.epicgames.com/documentation/en-us/fortnite/lego-pvp-extraction-template-in-unreal-editor-for-fortnite
Verse source files
- 01-fragment.verse · fragment
Turn this into a guided course
Add subscriberoundstarted 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.