Verse Library verse

01 Fragment

Instantiates a War Bus game object when a trigger or script event activates.

verse-library/using-war-bus-spawner-devices-in-fortnite-creative/01-fragment.verse

using /Fortnite.com/Devices
using /Verse.org/Simulation
using /Fortnite.com/WarBus

# This is our main script. It "listens" for events.
# Think of it like a referee who only blows the whistle when the rule is broken.
Create WarBusSpawnerScript() as VerseDevice {

    # This variable holds a reference to the War Bus Spawner device.
    # We'll set this in the editor, but Verse needs to know it exists.
    WarBusSpawner: WarBusSpawnerDevice = WarBusSpawnerDevice{}

    # This function runs when the Verse Device is initialized.
    # It’s like the "Start Game" button.
    OnBegin<override>()<suspends> {
        # We need to wait for the player to enter the zone.
        # We'll use an event listener for this.
        
        # Listen for the 'OnBeginPlay' event of the War Bus Spawner.
        # Actually, we want to listen to a Trigger Volume. 
        # Since we don't have the trigger in code yet, let's assume 
        # we're listening to the War Bus Spawner's 'OnSpawn' event 
        # for this example, but in reality, we'd link it to a trigger.
        
        # Let's simplify: We'll just spawn the bus immediately 
        # when the script starts, to show how it works.
        # In a real map, you'd link this to a Trigger Volume's 'OnBeginOverlap' event.
        
        SpawnWarBus()
    }

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