Verse Library verse

01 Device

Listens for zone trigger events to reward players with bonus items from configured granter devices.

verse-library/using-halloween-candy-consumables-in-fortnite-creative/01-device.verse

# SugarRush.galaxy
# A script that listens for Halloween Candy consumption and grants a bonus item
# via an item_granter_device when a player interacts with a trigger device.

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

# This is our main "Island" object. Think of it as the manager of our island's logic.
sugar_rush_island := class(creative_device):

    # DEVICE REFERENCES: Wire these up in the UEFN editor to real devices on your map.
    # CandyTrigger detects when a player steps on or interacts with the candy zone.
    @editable
    CandyTrigger : trigger_device = trigger_device{}

    # BonusGranter1 and BonusGranter2 are item_granter_devices placed on the map.
    # Set each one up in the editor to grant whichever item you want.
    @editable
    BonusGranter1 : item_granter_device = item_granter_device{}

    @editable
    BonusGranter2 : item_granter_device = item_granter_device{}

    # OnBegin runs automatically when the island session starts.
    # We use it to subscribe our handler to the trigger's event.
    OnBegin<override>()<suspends> : void =
        # EVENT: subscribe to the trigger so OnCandyTriggered runs

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