# This is a simple script for a Trigger device. # It starts the game when a player steps on it. using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is the main script block. # Think of it as the brain of the trigger. trigger_manager := class(creative_device) { # Bind a trigger_device from the editor so we can # listen to its TriggeredEvent. @editable MyTrigger : trigger_device = trigger_device{} # This line listens for a player. # "OnBeginPlay" is the event. # It happens when the game starts. OnBeginPlay() : void = { # Subscribe to the trigger's TriggeredEvent. # "TriggeredEvent" fires whenever a player # walks into the trigger volume. MyTrigger.TriggeredEvent.Subscribe(OnPlayerEntered) } # This function runs when someone walks in. # "Agent" is the Verse type for the entity # that activated the trigger. OnPlayerEntered(Agent : agent) : void = { # Cast the agent to a fort_character so we can # call character-level functions on them. if (Character := Agent.GetFortCharacter[]) { # Print a message to the output log. # Note: in-world HUD text requires a # hud_message_device placed in the editor; # Print() is the closest real logging call. Print("Adventure Begins!") } } }