Verse Library verse

01 Device

Grants items and displays messages when players enter a specific trigger volume.

verse-library/configure-the-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 rewards.
treasure_hunt := class(creative_device):
    # This is the Item Granter. It holds the Gold.
    @editable
    ItemGranter : item_granter_device = item_granter_device{}

    # This is the HUD Message. It shows text.
    @editable
    HudMessage : hud_message_device = hud_message_device{}

    # This is the Trigger. It watches for players.
    @editable
    Trigger : trigger_device = trigger_device{}

    # This runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Connect the trigger to our reward logic.
        # When the trigger fires, run GiveReward.
        Trigger.TriggeredEvent.Subscribe(GiveReward)

    # This function gives the reward.
    GiveReward(Agent : ?agent) : void =
        # 1. Grant items via the Item Granter device.
        # The item_granter_device is pre-configured in the World Editor
        # with the item and quantity you want to give (e.g. 10 Gold).

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