Verse Library verse

01 Standalone

Handles sentry elimination events to verify player kills and log debug messages during gameplay testing.

verse-library/team-elimination-7-testing-multiplayer-using-the-sentry-device-in-verse/01-standalone.verse

# We need to access the core Fortnite systems
use FortniteGameVerse://

# This is our main "Game Class". Think of it as the brain of your island.
# It holds all the variables and functions for your game mode.
team_elimination_game = class(Game):

    # This is a "Function". It’s a block of code that does a specific job.
    # We will call this function whenever a Sentry is eliminated.
    # The `?agent` part means "The person who killed the Sentry, IF there was one."
    # It's optional because sometimes traps kill sentries, and traps aren't players.
    TestPlayerEliminated(Agent : ?agent) : void =
        # This checks if 'Agent' actually has a value (is not empty).
        # If a player killed the sentry, Agent will have data.
        # If a trap killed it, Agent will be empty (None).
        if Agent != None:
            # Print is like the in-game chat log, but only for developers.
            # It helps us debug without cluttering the player screen.
            Print("Sentry Down! Player eliminated it.")
        else:
            Print("Sentry Down! Trap or glitch eliminated it.")

    # This function runs once when the game starts.
    Initialize() : void =
        # Get the specific Sentry device we placed in the editor.
        # You must name your Sentry device in the editor to match this string.
        sentry := GetEntity("TestSentry")

        # HERE IS THE MAGIC:
        # We subscribe to the Sentry's EliminatedEvent.

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