Verse Library verse

01 Device

Manages a crafting station that tracks player inputs and grants items via interaction events.

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

# We define a script named "dino_crafting_station"
# This script will run when someone interacts with the device.
# We bind it to an interactable_trigger_device so the editor gives
# us a real OnInteracted event to hook into.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

dino_crafting_station := class(creative_device):

    # Drag an Interactable Trigger Device into the editor and
    # connect it to this property so we can listen for interactions.
    @editable
    CraftingTrigger : interactable_trigger_device = interactable_trigger_device{}

    # item_granters placed in the editor supply the physical items.
    # Wire one granter per item type in the UEFN editor.
    @editable
    WhiteEggGranter : item_granter_device = item_granter_device{}   # configured to grant White Dino Egg

    @editable
    HealEggGranter  : item_granter_device = item_granter_device{}   # configured to grant Heal Egg

    # We track each player's egg count with a simple counter.
    # Key = agent hash; value = white-egg count the player has "spent" tokens for.
    # note: Verse has no runtime inventory-query API yet, so we manage
    # a logical counter that increments when the granter awards an egg
    # and decrements on a successful craft.
    var WhiteEggCounts : [agent]int = map{}

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