Verse Library verse

02 Fragment

Listens for player overlap events to locate a spawner device and instantiate a vehicle.

verse-library/car-racing-3-add-vehicles-in-unreal-editor-for-fortnite/02-fragment.verse

using {
    this
}

# Define the function that does the heavy lifting
spawn_vehicle := func():
    # Find the spawner by the name you gave it in the editor
    spawner := Find<Device>("MySpawner")
    
    # If the spawner exists...
    if (spawner != None):
        # ...use its Spawn function to create the car
        vehicle := spawner.Spawn()
        
        # Optional: Let's make sure we know it worked
        Print("Vehicle Spawned at " + str(spawner.Get_location()))
    else:
        Print("ERROR: Spawner not found! Check the name in the editor.")

# This runs when the game starts
OnBeginPlay := func():
    Print("System Online. Drive into the trigger to spawn.")

# We need to listen for the Trigger.
# Note: In Verse, you often attach logic to the device's events.
# Let's assume we named our Trigger "MyTrigger" in the editor.
OnBeginPlay := func():
    trigger := Find<Device>("MyTrigger")
    
    if (trigger != None):

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