Verse Library verse

01 Device

Applies disguises when players enter trigger zones. Perfect for spy or hide-and-seek game mechanics.

verse-library/using-disguise-devices-in-fortnite/01-device.verse

# This is the start of our script
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# We create our game manager class
# A class holds all our code in one place
spy_trap_manager := class(creative_device):

    # We connect to a Disguise Device placed in the island
    # Tag this device in the editor by selecting it and setting its Tag
    @editable
    MyDisguise : disguise_device = disguise_device{}

    # We connect to a Trigger Device so we know when a player steps on it
    # Place a Trigger Device in the island and link it here in the editor
    @editable
    MyTrigger : trigger_device = trigger_device{}

    # OnBegin runs automatically when the island starts
    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger so we know when a player enters
        MyTrigger.TriggeredEvent.Subscribe(OnPlayerEnter)
        # Subscribe to the disguise device's broken event
        # This fires when the disguise is removed for any reason
        MyDisguise.BreakDisguiseEvent.Subscribe(OnDisguiseRemoved)

    # When a player steps on the trigger, apply the disguise
    # This is the main action!
    OnPlayerEnter(Agent : ?agent) : 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