using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /Verse.org/Native } # Define our creative_device class. This is the script that runs on the island. my_lock_script := class(creative_device): # Drag your Lock Device from the World Outliner into this property slot # in the Details panel after compiling. @editable LockedDoor : lock_device = lock_device{} # Drag your Button Device from the World Outliner into this property slot # in the Details panel after compiling. @editable ControlButton : button_device = button_device{} # This function runs when the game starts. OnBegin() : void = # Make sure the door starts locked. LockedDoor.Lock() # Bind the button's InteractedWithEvent to our handler function. # When the button is pressed, RunUnlockLogic() will fire. ControlButton.InteractedWithEvent.Subscribe(RunUnlockLogic) # This function runs when the button is pressed. # button_device events pass the agent who triggered them. RunUnlockLogic(Agent : agent) : void = # Send a signal to the Lock Device to unlock. # Unlock() means the door is now openable. LockedDoor.Unlock() # Optional: Print a message in the debug console for us devs. Print("Door Unlocked! Loot is yours.")