Verse Library verse

01 Device

Activates a placed vehicle mod box spawner on game start to allow players to upgrade their cars.

verse-library/using-vehicle-mod-box-spawner-devices-in-fortnite-creative/01-device.verse

# This code sets up the upgrade machine.
# It uses the Fortnite Devices library.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We declare a creative_device class that holds our upgrade machine.
# In UEFN, you wire 'UpgradeMachine' to a placed Vehicle Mod Box Spawner
# in the Details panel — you do not construct devices in code.
upgrade_station := class(creative_device):

    # Declare a reference to the Vehicle Mod Box Spawner placed on the island.
    # Wire this in the UEFN Details panel to your placed device.
    @editable
    UpgradeMachine : vehicle_mod_box_spawner_device = vehicle_mod_box_spawner_device{}

    # OnBegin runs automatically when the game session starts.
    # This is where we turn the machine on.
    OnBegin<override>()<suspends> : void =
        # Enable the device so it works in the game.
        # This turns the machine on.
        # Note: VehicleType and ModType are configured in the UEFN
        # Details panel (set to SUV and Armor Plating respectively),
        # because the Verse API does not expose property setters for them.
        UpgradeMachine.Enable()

Comments

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