# This is a basic Verse script that listens for a player hitting a specific RR Checkpoint. # Note: In the editor, you must link this script to the specific RR Checkpoint device. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # A Verse device that holds a reference to an RR Checkpoint placed in the editor. # In the editor, drag your RR Checkpoint device into the 'MyCheckpoint' slot # on this script's Details Panel. checkpoint_listener := class(creative_device): # 'MyCheckpoint' is the editor-facing property slot. # rr_checkpoint_device is the real Verse type for the RR Checkpoint device. @editable MyCheckpoint : rr_checkpoint_device = rr_checkpoint_device{} # OnBegin runs once when the game session starts. # We use it to subscribe to the checkpoint's event. OnBegin() : void = # 'CheckpointReachedEvent' fires whenever any agent crosses this checkpoint. # We subscribe to it here so our handler runs every time it triggers. MyCheckpoint.CheckpointReachedEvent.Subscribe(OnCheckpointReached) # This function is called automatically each time a player hits the checkpoint. # 'Agent' is the Verse type for "whoever triggered the event." OnCheckpointReached(Agent : agent) : void = # Cast 'Agent' to 'player' so we can use player-specific APIs. # The 'if' block only runs if the cast succeeds (i.e., it really is a player). if (Player := player[Agent]): # Print to the debug console (the 'chat' for devs). # If you see this message in the log, your event wiring is working. Print("Player just hit the checkpoint! Time to boost!")