# This code makes the Item Granter work
# It listens for the Trigger signal
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# Define our main device
# This is the "brain" of our Gear Station
GearStation := class(creative_device):
# We connect the Trigger to the Granter
# When the Trigger fires, the Granter acts
@editable
Trigger : trigger_device = trigger_device{}
@editable
Granter : item_granter_device = item_granter_device{}
# This function runs when the game starts
OnBegin<override>()<suspends> : void =
# We tell the Trigger to listen
# It watches for players stepping on it
Trigger.TriggeredEvent.Subscribe(OnTriggered)
# This function runs each time the Trigger fires
OnTriggered(Agent : agent) : void =
# The Trigger fired!
# Now we tell the Granter to give items to the agent
Granter.GrantItem(Agent)
Verse Library
verse
01 Device
Grants items to players when they step on a trigger volume.
verse-library/using-the-item-granter-device-to-give-players-gear/01-device.verse