using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
door_opener := class(creative_device):
@editable
EntryTrigger : trigger_device = trigger_device{}
@editable
RewardGranter : item_granter_device = item_granter_device{}
OnBegin<override>()<suspends> : void =
EntryTrigger.TriggeredEvent.Subscribe(OnPlayerEntered)
OnPlayerEntered(Agent : ?agent) : void =
# The agent rode along on the event — hand it straight to the granter.
if (A := Agent?):
RewardGranter.GrantItem(A)
Print("Welcome gift granted!")
Verse Library
verse
04 Device
Subscribes to a trigger device event to grant items to entering players.
verse-library/verse-events-device-events/04-device.verse