Verse Library verse

01 Device

Creates a custom device that detects player entry and automatically grants configured items to agents.

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

# This is our main script file.
# It connects a trigger to a reward.

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

# We create a new "Actor".
# An Actor is a thing in our game world.
# Think of it like a character or a prop.
rusty_can_trap := class(creative_device):

    # This is our Trigger Volume.
    # It watches for players.
    # Wire this in the UEFN editor Details panel.
    @editable
    Trigger : trigger_device = trigger_device{}

    # This is our Item Granter.
    # It gives the item.
    # Wire this in the UEFN editor Details panel.
    @editable
    Granter : item_granter_device = item_granter_device{}

    # OnBegin runs once when the game starts.
    # We use it to subscribe to the trigger's overlap event.
    OnBegin<override>()<suspends> : void =
        # TriggeredEvent fires whenever any agent steps inside.
        # We pass our handler function to be called each time.
        Trigger.TriggeredEvent.Subscribe(OnTriggered)

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