using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
# This is our smart script for the door
SmartDoor := class(verse_device):
# We connect to the door device here.
# This is like plugging in a wire.
Door: lock_device = lock_device{}
# We connect to the trigger volume here.
# This is like setting up a motion sensor.
Trigger: volume_device = volume_device{}
# This variable remembers if the door is open.
# It starts as false (closed).
var IsDoorOpen: logic = false
# This runs when the game starts.
OnBegin<override>()<suspends>: void =
# We tell the trigger: "Watch for players!"
# When a player enters, run the function below.
Trigger.AgentEntersEvent.Subscribe(OnPlayerEnter)
# This function runs when a player enters the trigger.
OnPlayerEnter := func(agent: agent): void =
# Check if the door is already open.
if (IsDoorOpen == false):
# Unlock the door for this player.
# Think of this as turning the key.
Verse Library
verse
01 Standalone
Opens and unlocks a secret door for entering players, using a boolean flag to prevent repeated opening.
verse-library/door-open/01-standalone.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.