using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our main script. It runs the show. # creative_device is the real base class for Verse devices in UEFN. secret_room_manager := class(creative_device): # We need a reference to the door. # In Verse, we call things "variables". # A variable is like a box that holds a value. # Wire this PropMoverDevice in the UEFN Details panel. @editable Door : prop_mover_device = prop_mover_device{} # We need a reference to the Player Counter device. # Wire this PlayerCounterDevice in the UEFN Details panel. @editable Counter : player_counter_device = player_counter_device{} # We need a reference to the Trigger device that watches the zone. # Wire this TriggerDevice in the UEFN Details panel. @editable ZoneTrigger : trigger_device = trigger_device{} # OnBegin runs when the game starts. OnBegin() : void = # Subscribe to the trigger so we know when a player enters the zone. # TriggeredEvent fires each time an agent steps into the trigger volume. ZoneTrigger.TriggeredEvent.Subscribe(OnZoneTriggered) # This function fires when a player enters the zone. # An event is like a trigger. It happens at a specific moment. # agent? is the player who walked in — it may be false if no agent caused it. OnZoneTriggered(Agent : ?agent) : void = # Ask the counter how many players are in the zone. # This is like asking a question. # # note: player_counter_device exposes CurrentCount:int as a readable property. Count := Counter.GetCurrentCount[] # Check if the count is 3 or more. # This is a "condition". It is like a fork in the road. if (Count >= 3): # If true, open the door! # We send a signal to the door. Door.MoveToEnd() Print("Door is open! Welcome to the club!") else: # If false, keep the door closed. Print("Need more friends! Keep counting...")