# This is a simple Verse script # It connects a collectible to a door using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # Our main game class wires the two devices together. # In UEFN, set my_door and my_stud in the Details panel # by tagging the placed devices with these property names. treasure_hunt_manager := class(creative_device): # 1. Reference to the door device placed in the world @editable my_door : conditional_button_device = conditional_button_device{} # 2. Reference to the LEGO collectible device placed in the world @editable my_stud : collectible_object_device = collectible_object_device{} # OnBegin runs once when the game starts OnBegin() : void = # 3. Create the link # When the stud is collected... my_stud.CollectedEvent.Subscribe(OnStudCollected) # ...open the door! OnStudCollected(Agent : agent) : void = # Activate the conditional_button_device, which triggers # whatever action is wired to it in the Details panel # (set that action to "Unlock / Open" the door device). my_door.Activate(Agent) # note: door_device does not expose a direct Open() API in # Verse; the recommended pattern is to wire the door's # "Unlocked" input to this device's output in the Details # panel, or use a mutator_zone_device / switch_device as # the intermediary trigger.