Verse Library verse

01 Device

Detects trigger activation and grants configured items or accolades to winning players.

verse-library/rewards/01-device.verse

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

# This is our main script. It controls the victory gate.
WinnerGate := class(creative_device):
    # These are the devices we will use.
    # Think of them as tools in your toolbox.
    @editable
    VictoryTrigger : trigger_device = trigger_device{}
    @editable
    ItemGranter : item_granter_device = item_granter_device{}
    @editable
    Accolades : accolades_device = accolades_device{}

    # This runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Wait for the player to step on the trigger.
        # This is like waiting for a bell to ring.
        loop:
            # TriggeredEvent fires each time the trigger activates.
            MaybeAgent := VictoryTrigger.TriggeredEvent.Await()

            # The player stepped on the button!
            # Let's give them a reward.
            # TriggeredEvent returns a ?agent, so we unwrap it first.
            if (Agent := MaybeAgent?):

                # 1. Give them an item via the Item Granter 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