# We import the tools we need from Fortnite.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
# This is our keycard door manager device.
# It lives alongside a door_device placed on the island.
keycard_door_manager := class(creative_device):
# Wire this to the Door device in the UEFN editor.
@editable
Door : lock_device = lock_device{}
# Wire this to the Item Spawner device in the UEFN editor.
@editable
KeycardSpawner : item_spawner_device = item_spawner_device{}
# OnBeginPlay runs once when the game starts.
OnBeginPlay()<override>() : void =
# We print a message to the console.
# This helps us know the code is running.
Print("The door is waiting for a keycard.")
# We listen for the item spawner's pickup event.
# When a player picks up the keycard, we fire our check.
KeycardSpawner.ItemPickedUpEvent.Subscribe(OnKeycardPickedUp)
# This function runs when a player picks up the item from the spawner.
OnKeycardPickedUp(Agent : agent) : void =
Verse Library
verse
01 Device
Opens a locked device when a player picks up a specific keycard item from a spawner.
verse-library/create-an-item-pickup-interactable-component-in-fortnite/01-device.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.