# This is a simple Verse script # It changes the road color when a player touches it using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # Our manager class lives on a trigger_device placed at the road. # In the editor, place a trigger_device and set its name to "My_Road". road_manager := class(creative_device): # Wire this trigger_device to road_manager in the editor. # The trigger fires when a player walks into the road zone. @editable RoadTrigger : trigger_device = trigger_device{} # OnBegin runs once when the level starts. OnBegin() : void = # Listen for when a player enters the trigger volume. # trigger_device.TriggeredEvent gives us the agent who stepped in. RoadTrigger.TriggeredEvent.Subscribe(HandlePlayerEnter) # This function handles the event. # agent is the character that activated the trigger. HandlePlayerEnter(Source : ?agent) : void = # Cast agent to fort_character so we can call character functions. if (ActualSource := Source?, Character := ActualSource.GetFortCharacter[]): # Print a message to the output log so we know it worked. # Note: there is no built-in runtime HUD text API in Verse yet; # wire a billboard_device or notification_device in the editor # to the same trigger for visible in-game feedback. Print("You found the magic road!")