Verse Library verse

01 Device

Iterates through an array of vehicle mod box spawners and enables them automatically when the game begins.

verse-library/working-with-vehicles-on-your-fortnite-island/01-device.verse

# This is our main script file.
# It connects the Mod Box to the Car.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We create a new device type called ModRacer.
# This is like a blueprint for our game logic.
ModRacer := class(creative_device) {

    # This variable holds the list of boxes.
    # A "variable" is a container that can change.
    # Here, it holds a list of Mod Box devices.
    # note: @editable lets you assign these devices in the UEFN editor UI.
    @editable
    ModBoxes : []vehicle_mod_box_spawner_device = array{}

    # This function runs when the game starts.
    # It sets up our boxes.
    OnBegin<override>()<suspends> : void = {

        # We tell each box to start working.
        for (Box : ModBoxes) {
            # This line enables the box.
            # It makes the box active and ready to give out mods.
            Box.Enable()
        }
    }
}

Comments

    Sign in to vote, comment, or suggest an edit. Sign in