using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This script attaches to a creative_device you place on your island.
# It connects a trigger_device to an item_granter_device.
explosive_trap_device := class(creative_device):
# Place a Trigger Volume on your island and link it here.
@editable
MyTrigger : trigger_device = trigger_device{}
# Place an Item Granter device on your island.
# Set its item to Dynamite in the device properties.
# Then link it to this slot.
# note: item_granter_device is the real API for giving
# consumable items to players in UEFN Verse.
@editable
MyItemGranter : item_granter_device = item_granter_device{}
# OnBegin runs automatically when the game starts.
# We connect our function to the trigger here.
OnBegin<override>()<suspends> : void =
MyTrigger.TriggeredEvent.Subscribe(OnTriggerEntered)
# This function runs when a player enters the trigger volume.
# 'Agent' is the person who walked in.
OnTriggerEntered(Agent : agent) : void =
# Tell the Item Granter to give its item to this agent.
# The item (Dynamite) is configured in the device properties.
Verse Library
verse
02 Device
Assigns items to players entering a trigger volume, ideal for trap or reward mechanics.
verse-library/using-explosive-consumables-in-fortnite-creative/02-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.