Verse Library verse

01 Device

Spawns deployable bouncer props for triggering players while managing a limited usage counter.

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

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

# We are defining a new type of object called a Gadget.
# This is like creating a new blueprint for a device.
bouncer_gadget := class(creative_device):

    # This is our VARIABLE. Think of it as your "Ammo Counter."
    # It starts at 3, meaning you get 3 free bouncers.
    # 'var' makes it mutable so we can subtract from it later.
    var TrapsRemaining : int = 3

    # A reference to a prop_spawner_device placed on the island in UEFN.
    # We use a prop_spawner_device to handle the actual spawning,
    # because Verse cannot call SpawnActor for arbitrary game props directly.
    # Wire this device to a Bouncer Pad prop in the UEFN editor.
    # note: Verse has no free SpawnActor for arbitrary props; prop_spawner_device
    #       is the supported way to spawn props at runtime in UEFN.
    @editable
    BouncerSpawner : prop_spawner_device = prop_spawner_device{}

    # A reference to the button_device (or player_reference_device) that
    # tells us which player triggered the gadget.
    # Wire a trigger_device or item_granter_device's AgentActivates event
    # to call DeployBouncer in your island setup.
    @editable
    GadgetTrigger : trigger_device = trigger_device{}

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