using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
# This is our script. It runs when the game starts.
MyRandomDungeon := class(creative_device):
# These are the rooms. They are creative_prop devices.
# You must link these in the editor properties.
@editable
RoomA : creative_prop = creative_prop{}
@editable
RoomB : creative_prop = creative_prop{}
@editable
RoomC : creative_prop = creative_prop{}
# This is the main event. It runs once when the game starts.
OnBegin<override>()<suspends> : void =
# 1. Pick a random number between 1 and 3.
# GetRandomInt returns a value in the range [Low, High] inclusive.
Choice : int = GetRandomInt(1, 3)
# 2. Hide all rooms first.
# We start with a blank slate.
RoomA.Hide()
RoomB.Hide()
RoomC.Hide()
Verse Library
verse
01 Device
Randomly selects and displays one of three linked room props on game start to create dynamic layouts.
verse-library/fortnite-random-room-spawning-using-scene-graph/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.