Verse Library verse

01 Device

Spawns random military buildings at a location when a button is pressed.

verse-library/using-military-prefabs-in-fortnite-creative/01-device.verse

# Import the necessary modules for interacting with the game world
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Symbols }

# Define our main script. This is the "brain" of our Command Drop Station.
# It inherits from Device, meaning it lives inside a device in the editor.
command_drop_station := class(creative_device):
    # This is our "Inventory" of available military prefabs.
    # We list the paths to the actual prefab assets in the game.
    # Think of this like your loot pool in a Battle Royale.
    military_prefabs := [
        "/Game/PrimalEarth/Environment/Ego/Buildings/EGo_StagingPost/EGo_StagingPost.EGo_StagingPost",
        "/Game/PrimalEarth/Environment/Ego/Buildings/EGo_ScienceStation/EGo_ScienceStation.EGo_ScienceStation",
        "/Game/PrimalEarth/Environment/Ego/Buildings/EGo_Checkpoint/EGo_Checkpoint.EGo_Checkpoint"
    ]

    # We need references to the devices we placed in the editor.
    # This is like linking your controller to your console.
    button: button_device = creative_device.GetDevice("/Game/Maps/YourMapName.CommandButton")
    drop_zone: target_device = creative_device.GetDevice("/Game/Maps/YourMapName.DropZone")

    # This function runs when the button is pressed.
    # It's like the "Elimination Event" — something happened, now react.
    on_button_pressed := function():
        # 1. Pick a random prefab from our list.
        # This is like spinning the loot wheel.
        random_index := GetRandomInt(0, Size(military_prefabs) - 1)
        chosen_prefab_path := military_prefabs[random_index]

        # 2. Get the location and rotation of the Drop Zone.

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