# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-tracker-devices-in-fortnite-creative
# Local doc: epic-docs/documentation/en-us/fortnite-creative/using-tracker-devices-in-fortnite-creative.md
# Section: Using the Tracker Device in Verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
# A Verse-authored creative device that can be placed in a level
tracker_device_verse_example := class(creative_device):
# Reference to the Switch Device in the level.
# In the Details panel for this Verse device,
# set this property to your Switch Device.
@editable
MyTrackerDevice:tracker_device = tracker_device{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
# Example for subscribing to an event on the Creative device.
# Signaled when the tracked value reaches `GetTarget` for an `agent`.
# Sends the `agent` that reached `GetTarget` for their tracked value.
MyTrackerDevice.CompleteEvent.Subscribe(OnObjectiveCompleted)
for(Player : GetPlayspace().GetPlayers()):
# Sets the target value that must be achieved in order for `CompleteEvent` to trigger.
# Clamped to `0 <= TargetValue <= 10000`.
MyTrackerDevice.SetTarget(5)
# Assign Tracker device to player.
MyTrackerDevice.Assign(Player)
# Get random integer value between 1 and 3.
TargetValueIncrease:int = GetRandomInt(1,3)
Print("Random target increase is {TargetValueIncrease}")
# Increase this player's target value by the random integer.
Verse Library
verse
01 Using The Tracker Device In Verse
Assigns tracking targets to players, randomizes values, and triggers completion events.
extracted-snippets/documentation/en-us/fortnite-creative/using-tracker-devices-in-fortnite-creative/01-using-the-tracker-device-in-verse.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.