Build Your Own Castle with Verse
Build Your Own Castle with Verse
Do you want to build a secret castle that only appears when you find a hidden key? In Fortnite Creative, you can use Verse to make structures appear, move, or change. This tutorial shows you how to use Verse to control building pieces. You will create a simple bridge that appears when a player steps on a switch. It is like magic, but with code.
What You'll Learn
- What a Gallery is in Fortnite Creative.
- How to use Verse to spawn (create) objects.
- How to use an Event to react to player actions.
- How to build a simple interactive structure.
How It Works
Think of your island like a giant toy box. Inside the box are thousands of building pieces. These pieces are organized into Galleries. A Gallery is just a folder of similar items. For example, there is a "Seaside Gallery" with shells and boats. There is a "Structures Gallery" with walls and floors.
In Verse, we treat these building pieces like Entities. An Entity is any object in the game world. It can be a player, a tree, or a wall. We can tell an Entity to move, change color, or disappear.
We will use a Trigger. A Trigger is an invisible box. When a player walks into it, something happens. We will write code that says: "When the player hits the Trigger, spawn a bridge from the Gallery." This makes your island feel alive. It reacts to you!
Let's Build It
We will build a bridge that appears when you step on a button.
Step 1: Set Up Your Island
- Open UEFN (Unreal Editor for Fortnite).
- Place a Trigger Volume in the middle of your island. Make it big enough for a player to stand on.
- Place a Button near the Trigger. Connect the Button to the Trigger using a Device Network. (Click the Button, then click the Trigger to link them).
- Find a bridge piece in the Galleries tab. Drag it into your world. Let's call this the "Ghost Bridge." It is a copy of the real bridge.
Step 2: Write the Verse Code
We need to tell the Ghost Bridge to become real when the button is pressed. Here is the code.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This script controls the bridge
bridge_script := class(creative_device):
# This is the Button device linked in the editor Details panel
@editable
Button : button_device = button_device{}
# This is the prop device representing the "Ghost" bridge placed in the editor
# Use a 'prop_manipulator_device' to show/hide a placed prop
@editable
GhostBridge : prop_manipulator_device = prop_manipulator_device{}
# This is the function that runs when the game starts
OnBegin<override>()<suspends>: void =
# Subscribe to the button's InteractedWithEvent so we react when pressed
Button.InteractedWithEvent.Subscribe(OnButtonPressed)
# This runs when the button is pressed
# agent is the player who pressed the button
OnButtonPressed(Agent : agent): void =
# Show the bridge prop and re-enable its collision
GhostBridge.Enable()
# Wait 5 seconds, then hide the bridge again
# Remove the two lines below if you want the bridge to stay forever
spawn { WaitAndHide() }
WaitAndHide()<suspends>: void =
Sleep(5.0)
GhostBridge.Disable()```
### Walkthrough of the Code
* `class(creative_device)`: This tells Verse we are writing a script for a device placed in the editor. Every Verse device extends `creative_device`.
* `@editable`: This keyword exposes the variable to the UEFN Details panel. You drag your real devices into these slots — no need to search by name at runtime.
* `Button : button_device`: This is a **Variable**. It holds a reference to the Button device you placed on the island.
* `GhostBridge : prop_manipulator_device`: This holds a reference to a **Prop Manipulator** device. The Prop Manipulator is placed on top of your bridge prop in the editor, and it controls whether the prop is visible and solid.
* `OnBegin`: This runs once when the island starts. It calls `Subscribe` so that every time the Button is pressed, `OnButtonPressed` fires automatically.
* `OnButtonPressed`: This is our **Function**. It is a list of instructions. It makes the bridge appear.
* `GhostBridge.Show()`: This makes the bridge appear and solid. Now players can walk on it!
* `Sleep(5.0)`: This pauses the function for 5 seconds before running the next line. # note: Sleep() is the correct Verse built-in for time delays; it requires the calling context to be `<suspends>` — mark OnButtonPressed `<suspends>` or spawn it with `spawn{ OnButtonPressed(Agent) }` if you add the delay.
* `GhostBridge.Hide()`: This makes the bridge invisible again after the delay.
### Step 3: Link It Up
1. Add the **Verse Script** device to your island.
2. Drag the `bridge_script` into the Verse Script device.
3. In the **Details** panel for the Verse Script device, drag your Button device into the `Button` slot.
4. Place a **Prop Manipulator** device on your bridge prop. Set the prop to start hidden in its settings.
5. Drag the Prop Manipulator into the `GhostBridge` slot in the Details panel.
Now, play your island. Step on the button. The bridge appears! You just coded a structure.
## Try It Yourself
Can you make the bridge disappear after 5 seconds?
**Hint:** Use the `Sleep` function with a time delay. The code already shows this with `Sleep(5.0)` inside `OnButtonPressed`. Then `GhostBridge.Hide()` hides it again. Try changing the number `5.0` to `10.0` to give players more time to cross!
## Recap
You learned how to use Verse to control building pieces. You used a **Variable** to store the bridge. You used an **Event** to react to a button. You made a structure appear and become solid. This is just the start. You can make walls move, doors open, and towers spin. Keep building!
## References
* https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-decoration-galleries-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite/decoration-galleries-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite/residential-galleries-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-seaside-galleries-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite/30-10-fortnite-ecosystem-updates-and-release-notes-in-creative-and-unreal-editor-for-fortnite
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add Building structures and galleries on your island 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.