Verse Library verse

01 Fragment

Tutorial script showing device binding, state variables, and event waiting for a vertical course game loop.

verse-library/big-rig-device-design-examples-in-fortnite-creative/01-fragment.verse

// 1. The Script Header
// This tells the game: "I am a script that runs when the game starts."
script class VerticalVictoryScript: IScript {
    
    // 2. Components (The "What")
    // These are references to devices you place in the level.
    // Think of these as "slots" where you plug in your real devices.
    button_device: ButtonDevice = Self.GetActor()
    timer_device: TimerDevice = Self.GetActor()
    
    // 3. Constants (The "Rules")
    // These values never change. Like the max health in a standard match.
    const WIN_TIME := 60.0 // 60 seconds to win
    
    // 4. Variables (The "State")
    // These change during the game. Like your shield level.
    game_active: bool = false
    
    // 5. Events (The "Triggers")
    // This runs once when the island loads.
    OnBegin<override>()<suspends> {
        // Start the timer immediately
        timer_device.StartTimer(WIN_TIME)
        
        // Mark the game as active
        game_active = true
        
        // Wait for the timer to finish OR the button to be pressed
        WaitForGameEnd()
    }

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