using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
# This is our Treasure Hunter Device
treasure_hunter_device := class(creative_device):
# This is the number of points needed to win
WinScore : int = 5
# This is the device that gives the points
@editable
PowerupDevice : stat_powerup_device = stat_powerup_device{}
# This is the trigger that detects players walking in
@editable
TriggerDevice : trigger_device = trigger_device{}
# This runs when the game starts
OnBegin<override>()<suspends> : void =
Print("Treasure Hunt Started!")
# Subscribe to the trigger so we know when a player enters
TriggerDevice.TriggeredEvent.Subscribe(OnTreasureTriggered)
# This runs when a player touches the trigger
OnTreasureTriggered(Agent : ?agent) : void =
if (LiveAgent := Agent?):
if (Player := player[LiveAgent]):
# Give the player 1 point via the Stat Powerup device
PowerupDevice.GrantToAgent(LiveAgent)
Verse Library
verse
01 Device
Awards points to players who trigger zones and checks if they reach the winning score.
verse-library/using-stat-powerup-devices-in-fortnite-creative/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.