Verse Library verse

01 Fragment

Connects a trigger to a level loader to dynamically load the next floor when players enter a volume.

verse-library/using-level-loader-devices-in-fortnite-creative/01-fragment.verse

# Import the necessary Verse frameworks
using /Fortnite.com/Devices
using /Engine/Systems

# Define our Main Device. This is the "Brain" of our trap.
# It will watch for players and then load the next floor.
type LoadNextFloorDevice = script {
    # The Trigger that detects the player
    Trigger: trigger_device = device:trigger_device()
    
    # The Level Loader that holds our hidden floor
    HiddenFloorLoader: level_loader_device = device:level_loader_device()
    
    # The name of the level we want to load (must match your saved Level Instance)
    LevelToLoad: string = "Secret_Basement"
    
    # This runs when the game starts
    OnBegin<override>()<suspends>: void = (
        # Connect the Trigger to our function
        Trigger.OnBegin += OnPlayerEntered
    )
    
    # This function runs when the trigger is activated
    OnPlayerEntered<override>(trigger: trigger_device, player: player): void = (
        # Check if the player who triggered it is the local player (optional)
        # or if we just want to load the level for everyone.
        
        # Load the level from our library
        # We use the 'Load' method on the Level Loader device
        HiddenFloorLoader.Load(LevelToLoad)

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