Verse Library verse

01 Device

Spawns supply drops when players press buttons and have enough currency tracked by a score manager.

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

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

# This is our main script structure. Think of it as the "brain" of the device.
loot_goblin_device := class(creative_device):

    # 1. DEFINE THE DEVICES
    # We declare editable references to the devices we placed in the editor.
    # Select this Verse device in UEFN and assign each slot in the Details panel.
    @editable
    MySupplyDrop : supply_drop_spawner_device = supply_drop_spawner_device{}

    # We also need a way to interact with players. We'll use a simple
    # PlayerScoreDevice to track gold. Place one in the editor and assign it here.
    @editable
    GoldTracker : score_manager_device = score_manager_device{}

    # We need a button_device so players can trigger the purchase.
    # Place one in the editor near the Trigger Zone and assign it here.
    @editable
    PurchaseButton : button_device = button_device{}

    # 2. DEFINE THE COST
    # The gold cost of a single supply drop.
    DropCost : int = 100

    # 3. OnBegin runs once when the game starts. We wire up our events here.
    OnBegin<override>()<suspends> : void =

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