Verse Library verse

01 Device

Spawns a prop or gift box at a player's location when they step into a designated trigger volume.

verse-library/spawning-props-and-actors-from-verse-code/01-device.verse

# This is the main script for our spawning machine.
# It lives on a trigger_device placed on the island.

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

# pop_up_prize_device is the name of our class.
# It must match the name of your Verse file exactly.
pop_up_prize_device := class(creative_device):

    # A trigger_device placed in the editor.
    # When a player walks into it, we get an event.
    @editable
    Trigger : trigger_device = trigger_device{}

    # A prop_spawner_base_device placed in the editor.
    # Point its "Prop Asset" field at your Gift Box in the Details Panel.
    # This device handles the actual spawning for us.
    @editable
    GiftBoxSpawner : prop_spawner_base_device = prop_spawner_base_device{}

    # OnBegin runs automatically when the game starts.
    # We use it to connect our trigger to our function.
    OnBegin<override>()<suspends> : void =
        # Tell the Trigger: whenever a player enters, call OnPlayerEntered.
        Trigger.TriggeredEvent.Subscribe(OnPlayerEntered)

    # This function runs when a player touches the trigger.

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