Verse Library verse

01 Fragment

Subscribes to trigger events to detect player entry and activate storm phase progression logic.

verse-library/battle-royale-storm/01-fragment.verse

# Import the necessary Fortnite frameworks
using { /Fortnite.com/Devices }
using { /Verse.org/Sim }

# This is our "Main" script. It runs when the game starts.
# Think of it as the "Game Start" event in the device editor.
script() =
    # We need to find our devices in the world.
    # In Verse, we use 'Get' to grab a reference to a device by its name.
    # If you named your controller "MyStormController" in the editor, use that name.
    storm_controller := Get<AdvancedStormControllerDevice>("MyStormController")
    trigger_zone := Get<TriggerVolumeDevice>("MyTriggerZone")

    # This function runs when the game starts
    OnStart() =
        # Print a message to the debug console (F8 in-game)
        Print("Storm is ready. Enter the zone to shrink it!")

    # This function runs when an agent (player) enters the trigger zone
    OnBeginPlay() =
        # Subscribe to the 'OnEnter' event of the trigger zone.
        # This is like saying: "When someone steps here, run this code."
        trigger_zone.OnEnter.Subscribe(OnPlayerEnter)

    # This is the function that runs when a player enters the zone
    OnPlayerEnter(entering_agent: Agent) =
        # Check if the thing entering is actually a player (agent)
        if entering_agent.IsAgent():
            # Signal the storm controller to advance to the next phase.
            # This is the "Variable" changing: Phase 1 -> Phase 2.

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