Verse Library verse

01 Device

Awards configurable XP to players when they interact with a designated device.

verse-library/using-accolades-devices-in-unreal-editor-for-fortnite/01-device.verse

# We are creating a new device called "SmartAccoladeDevice"
# This device inherits from the base Accolades device logic
# but allows us to customize the XP amount dynamically.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# This is our custom device definition.
# Think of this as a blueprint for our XP machine.
SmartAccoladeDevice := class(creative_device):
    # A variable to hold the XP amount.
    # This is like a "slider" you can tweak in the editor.
    # In game terms, this is the "value" of the loot drop.
    @editable
    XP_Amount: int = 100

    # This is a "Function".
    # A function is a set of instructions that runs when called.
    # Think of it like a "Gadget" in your phone tool:
    # you press a button, and it does a specific thing.
    OnBegin<override>()<suspends>: void=
        # When this device starts, we listen for interactions.
        # We bind a function to the "InteractedWithEvent" event.
        # This is like wiring a tripwire to an explosion.
        # When someone touches the trigger, 'GrantXP' runs.
        InteractedWithEvent.Await()

    # The function that actually gives the XP.
    GrantXP(InAgent: agent): void=
        # We use the built-in 'award_accolade_device' to grant XP.

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