Stop Playing in the Dark: How to Build a Day/Night Vault with the Real Time Clock
Unverified — this example may not compile as-is.
The Verse code below did not pass our automated compile check, so it isn't marked verified and is hidden from the guide listing. The explanation may still be useful, but treat the code as a draft and adapt it before use.
Stop Playing in the Dark: How to Build a Day/Night Vault with the Real Time Clock
Imagine you’re trying to loot the legendary vault in Fortnite Creative, but it’s locked tight. You can’t open it. Why? Because the vault only unlocks during real-world business hours, or maybe only when it’s nighttime in your actual timezone. This isn’t a bug; it’s a feature.
In this tutorial, we’re going to ditch the boring "press button to open door" mechanics and build a Real-Time Vault. We’ll use the Real Time Clock device to sync your island with the actual world clock. By the end, you’ll have a secure stash that only opens when the sun is up (or down, depending on your mood), complete with a countdown timer that keeps impatient players guessing.
What You'll Learn
- What the Real Time Clock device is and why it’s basically your island’s heartbeat.
- How to use UTC (Coordinated Universal Time) to standardize time across all players.
- How to connect the clock to a Prop Mover or Door to create time-gated content.
- How to set up a simple Logic chain that checks the time before allowing entry.
How It Works
The Concept: Your Island vs. The Real World
Normally, Fortnite islands run on "Game Time." If you make a storm close in 5 minutes, it closes in 5 minutes, regardless of whether it’s 3 PM or 3 AM in New York. But sometimes, you want your island to care about the real world. Maybe you want a shop to only stock "Night Mode" skins after 8 PM. Maybe you want a boss to only spawn at midnight.
That’s where the Real Time Clock comes in. It’s a device that looks at the clock on your phone, PC, or console and says, "Hey, it’s 2:30 PM on a Tuesday." It gives you the current time in UTC (Coordinated Universal Time). Think of UTC as the "global standard time" — it’s like the master clock that everyone in the world agrees on, so you don’t have to worry about whether your player is from Tokyo or Toronto.
The Mechanic: Time-Gating
In game terms, this is called Time-Gating. It’s like a bouncer at a club. The bouncer (the logic) checks your ID (the time). If your ID says it’s past 10 PM, you get in. If it’s 2 PM, you’re stuck outside.
We’re going to build a vault that stays locked until a specific UTC time. We’ll use the clock to trigger a Prop Mover (which moves objects) or a Door to open the path.
Why UTC?
You might ask, "Why not just use local time?" Because if you use local time, a player in London and a player in Los Angeles will see different times. UTC ensures that everyone on your island sees the same "game state" at the same moment. It keeps things fair and synchronized.
Let's Build It
We’re going to build a Day/Night Vault. It will only open between 6 AM and 6 PM UTC. Outside those hours, it stays locked.
Step 1: Place Your Devices
- The Vault Door: Place a large Door or a Prop Mover (set to move a block that blocks the entrance) at your vault entrance. Let’s call this the "Barrier."
- The Real Time Clock: Go to your Device Library, search for Real Time Clock, and place it anywhere on the map. It doesn’t matter where, as long as it’s in the same island.
- The Logic: We need a way to tell the door when to open. We’ll use Logic Bricks (the visual coding system in UEFN).
Step 2: Connect the Dots (Visual Logic)
If you’re using the visual logic editor:
- Click on your Real Time Clock device.
- Look for the output that says Time. This gives you the current time.
- We need to check if the time is between 6 AM and 6 PM. In UEFN, you can use Compare devices.
- Add a Compare device. Set it to check if
Time >= 6. - Add another Compare device. Set it to check if
Time <= 18(18 is 6 PM in 24-hour format). - Connect these two compares to an And device. This means both conditions must be true.
- Add a Compare device. Set it to check if
- Connect the output of the And device to your Door or Prop Mover.
- If the output is
True, the door opens. - If the output is
False, the door stays closed.
- If the output is
Step 3: The Verse Way (For the Code-Savvy)
If you prefer writing Verse (or want to understand what’s happening under the hood), here’s how you’d do it in code. This script checks the real-world time and opens the door if it’s daytime.
# Import the necessary tools
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /EpicGames.com/RealTimeClock }
# Define our Vault Script
vault_script := class(verse_script):
# This is our door. We'll connect it in the editor.
Door := property(Door):
get => Door
# This is our Real Time Clock device.
Clock := property(RealTimeClock):
get => Clock
# This function runs when the game starts
OnBegin<override>()<suspends>: void =>
# We'll loop forever, checking the time every second
loop:
# Get the current time from the Real Time Clock
# The clock gives us UTC time (0-24 hours)
CurrentTime := Clock.GetTime()
# Check if the time is between 6 AM (6) and 6 PM (18)
# If it is, open the door. If not, close it.
if CurrentTime.Hour >= 6 and CurrentTime.Hour < 18:
Door.Open()
else:
Door.Close()
# Wait 1 second before checking again
Wait(1.0)
Walkthrough of the Code
vault_script := class(verse_script):: This creates a new "container" for our logic. Think of it like a custom device you’re building.Door := property(Door):: This is a placeholder. In the UEFN editor, you’ll drag and drop your actual door into this slot.Clock := property(RealTimeClock):: Same thing. You’ll connect your Real Time Clock device here.OnBegin<override>()<suspends>: void =>: This is the function that runs when the island starts. It’s like the "Start" button on your controller.CurrentTime := Clock.GetTime(): This grabs the current UTC time from the Real Time Clock.if CurrentTime.Hour >= 6 and CurrentTime.Hour < 18:: This is the bouncer. It checks if the hour is 6 or higher AND less than 18. If yes, the door opens.Wait(1.0): This pauses the script for 1 second. Without this, the script would check the time thousands of times per second, which is a waste of energy.
Try It Yourself
Challenge: Build a "Midnight Boss" arena. Create a boss that only spawns between 12 AM and 1 AM UTC. If the time is outside that window, the boss should be invisible or invincible.
Hint: You can use the Visibility property on the boss actor, or set its Health to 0 outside the time window. Remember to use the Real Time Clock device to get the time, and a Compare device to check if the hour is 0 (midnight).
Recap
- The Real Time Clock device syncs your island with the real world’s UTC time.
- Use UTC to ensure all players experience the same time-based events.
- Combine the clock with Logic or Verse to gate content, like doors or bosses, based on the time of day.
- This allows for dynamic, real-world-linked gameplay that keeps your island fresh and exciting.
References
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-real-time-clock-devices-in-fornite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-real-time-clock-devices-in-fornite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/lego-santas-toy-factory-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/uefn/lego-santas-toy-factory-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-real-time-clock-devices-in-fortnite-creative
Verse source files
- 01-standalone.verse · standalone
Turn this into a guided course
Add using-real-time-clock-devices-in-fornite-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.