Verse Library verse

01 Device

Tracks race timing and saves player checkpoint progress when they reach a trigger zone.

verse-library/using-save-point-devices-in-fortnite-creative/01-device.verse

# This is the main script for our race checkpoint.
# It uses the Save Point device to remember the player.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# We create a new device type called "RaceCheckpoint".
# This is like a blueprint for our checkpoint.
race_checkpoint := class(creative_device):
    # This is the Save Point device we placed in the world.
    # It is a reference to the actual object on the map.
    # Wire this in the UEFN Details panel — do not set it here.
    @editable
    SavePoint : checkpoint_device = checkpoint_device{}

    # This is the Timer device we placed in the world.
    # It tracks how long the race takes.
    # Wire this in the UEFN Details panel — do not set it here.
    @editable
    Timer : timer_device = timer_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Subscribe to the checkpoint device's activation event.
        # CheckpointDevice fires ActivatedEvent when a player touches it.
        SavePoint.CheckpointActivatedEvent.Subscribe(OnPlayerReachedCheckpoint)

        # Start the race timer as soon as the game begins.

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.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in