Verse Library verse

01 Device

Enables an item spawner device at game start to distribute configured items to players.

verse-library/using-ranged-weapon-items-in-fortnite-creative/01-device.verse

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

# This is our main script. It is like the brain of our spawner.
# We attach it to a Verse device placed on the island.
rusty_can_spawner := class(creative_device):

    # The editor will wire this item_spawner_device to our script.
    # Drag an Item Spawner device onto your island and connect it here.
    @editable
    Spawner : item_spawner_device = item_spawner_device{}

    # OnBegin runs automatically when the game starts.
    OnBegin<override>()<suspends> : void =
        # Tell the spawner to start giving out items right away.
        # The item type and count are set in the Item Spawner device
        # properties inside the editor (for example: Rusty Can, Count = 5).
        # note: item_spawner_device does not expose a runtime Set_Given_Item API;
        # configure the item and stack count in the device's property panel.
        Spawner.Enable()

Comments

    Sign in to vote, comment, or suggest an edit. Sign in