Verse Library verse

01 Fragment

Reads a player score on a pressure plate trigger and activates a light based on the value.

verse-library/getcurrentscore/01-fragment.verse

using { /Fortnite.com/Devices }

# We define a simple script that checks the player's score when they step on a plate.
# 'Score_Checker' is the name of our script object.
Score_Checker: script =
    # This is a 'Signal'. Think of it as a wire connecting two devices.
    # When the 'Pressure_Plate' is stepped on, this signal fires.
    On_Player_Steps: signal() = Pressure_Plate.Stepped

    # This is the 'Event' that runs when the signal fires.
    OnBegin<override>()<suspends>:
        # 1. Get the Local Player (The Agent)
        # In Verse, 'Get_Local_Player()' gives us the Agent of the person playing.
        # If you want to check a *specific* player, you'd pass their Agent ID here.
        local_player: agent = Get_Local_Player()

        # 2. Ask the Score Manager for the current score
        # We use the 'Score_Manager' device we placed in the level.
        # GetCurrentScore(local_player) asks: "What is this player's score?"
        # It returns an 'int' (a whole number).
        current_points: int = Score_Manager.GetCurrentScore(local_player)

        # 3. Check the score and react
        # We use an 'if' statement. This is like a decision gate.
        if current_points > 0:
            # If score is > 0, turn on the 'Good_Light' switch
            Good_Light.SwitchOn()
            # Print a message to the player (like a chat message)
            Print_To_Player(local_player, "You're a killer! Score: " + As_String(current_points))
        else:

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