using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.comTemporary/Temporal } # This is our main script, attached to the Button # Think of this as the "Brain" of the button security_console := class(VerseSpeaker): # VARIABLES: These are our "slots" for data. # AccessLevel is like a player's rank (0 = civilian, 1 = agent) AccessLevel : int = 0 # The door we want to control. We'll link this in the editor. # Think of this as pointing to the specific door in the level. BunkerDoor : PropMoverDevice = PropMoverDevice{} # The sound to play if access is denied DeniedSound : AudioDevice = AudioDevice{} # FUNCTIONS: Reusable blocks of logic. # This function checks if the player is authorized. # It returns true or false, like a light switch being on or off. IsPlayerAuthorized := func(Player : Player): bool -> # In a real game, you'd check for a specific item or team. # For this demo, we'll pretend any player with > 0 access is okay. # Let's say if the player has a specific item "Keycard", we set their access to 1. # Since we can't easily check items in simple Verse without complex APIs, # we will simulate it: if the player is on Team 1, they are authorized. if Player.GetTeam() == 1: return true else: return false # This function actually opens the door. # It's like pressing the "Open" button on a remote. OpenBunker := func(): void -> # This tells the Prop-Mover to play its "Open" animation. # Think of it like telling a Prop-Mover to go to its "Open" state. BunkerDoor.PlayAnimation("Open") # You could also add a sound effect here for success. # EVENTS: This runs when the button is pressed. # Think of this as the "Trigger" that starts the sequence. OnButtonPressed := func(): void -> # Get the player who pressed the button. # Think of this as asking "Who touched me?" Presser := GetPlayer() if Presser != nil: # Check if they are authorized using our function. if IsPlayerAuthorized(Presser): # If yes, open the door! OpenBunker() else: # If no, play the denial sound. DeniedSound.Play()