Verse Library verse

01 Device

Spawns vehicles and handles destruction events to create an endless driving gauntlet loop.

verse-library/using-suv-spawner-devices-in-fortnite-creative/01-device.verse

# InfiniteSUV.verse
# A simple script to respawn an SUV instantly when it's destroyed.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# 1. DEFINE THE SCRIPT
# This is the "container" for our logic.
# We name it "infinite_suv_script".
# creative_device is the real base class for all UEFN device scripts.
infinite_suv_script := class(creative_device):

    # 2. DEFINE THE DEVICE REFERENCE
    # This variable holds the link to the SUV Spawner device.
    # '@editable' exposes this field in the UEFN details panel so you can
    # drag-and-drop the actual SUV Spawner device onto it in the editor.
    # 'suv_spawner_device' is the real Verse type for this device.
    @editable
    SuvSpawner : suv_spawner_device = suv_spawner_device{}

    # 3. INITIALIZATION — OnBegin runs once when the island session starts.
    # We use this to subscribe to the events we care about.
    OnBegin<override>()<suspends> : void =
        # 4. SUBSCRIBE TO THE VEHICLE DESTROYED EVENT
        # 'VehicleDestroyedEvent' is the real listenable on suv_spawner_device.
        # '.Subscribe()' registers our handler function to be called each time
        # the event fires.
        SuvSpawner.VehicleDestroyedEvent.Subscribe(HandleVehicleDestroyed)

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