# Import the necessary Fortnite devices
using { /Fortnite.com/Devices }
# Define our main device type.
# This acts as the "brain" that connects the Tracker and Accolades.
SlayerChallenge := class(creative_device):
# These are references to the devices we placed in the editor.
# Think of these as "wires" we’ll connect in the editor.
Tracker: tracker_device = tracker_device{}
Accolades: accolades_device = accolades_device{}
# This function runs when the game starts.
OnBegin<override>()<suspends>: void=
# We need to listen for when the Tracker hits its goal.
# The Tracker emits an event called 'GoalReached' on a specific channel.
# We'll use Channel 1 for this challenge.
# Subscribe to the Tracker's GoalReached event.
# When the tracker hits 3 kills, this lambda (anonymous function) runs.
Tracker.GoalReached.Subscribe(
func(player: player, channel: int): void=
# Check if the signal came from our specific channel (Channel 1)
if channel == 1:
# Award the accolade to the player who triggered it.
# This is where the XP gets handed out.
Accolades.Award(player, "Slayer of Ice")
)
Verse Library
verse
01 Device
Awards player accolades when a tracker device reaches a specific goal count.
verse-library/using-accolades-devices-in-fortnite-creative/01-device.verse