# This is a simple script for a "Loot Goblin" trap.
# When a player steps on the trigger, they get a random weapon.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
# Define our Trap Device
LootGoblinTrap := class(creative_device):
# This is the "Trigger" - like a pressure plate
Trigger : trigger_device = trigger_device{}
# This is the "Reward" - what they get
LootBox : item_granter_device = item_granter_device{}
# This function runs when the game starts
OnBegin<override>()<suspends>: void =
# Wait for the trigger to be hit
Trigger.TriggeredEvent.Subscribe(OnPlayerHit)
# This function runs when a player steps on the trigger
OnPlayerHit(Agent: ?agent): void =
# Get the player who hit it
if (TheAgent := Agent?):
# Give them a random weapon
# (In a real map, you'd pick a specific weapon)
LootBox.GrantItem(TheAgent)
Verse Library
verse
01 Device
Grants an item to any player who steps on a pressure plate trigger device.
verse-library/using-nature-and-terrain-galleries-in-fortnite-creative/01-device.verse