Verse Library verse

01 Fragment

Checks player inventory requirements and activates a crafting button when materials are available.

verse-library/using-nature-consumables-in-fortnite-creative/01-fragment.verse

# This is our main script for the crafting table.
using { /Fortnite.com/Devices }
using { /Verse.org/Sim }

# This is the device that holds our code.
# Think of it as the brain of our table.
actor MyCraftingTable() : Device() is
    # This is the button players press.
    CraftButton : ConditionalButtonDevice = self:GetDevice<ConditionalButtonDevice>("CraftButton")
    
    # This is the rule for unlocking.
    # We need 5 herbs to craft.
    RequiredHerbs := 5
    
    # This is the event when a player walks up.
    OnBegin<override>()<suspends>:void=
        # We wait for the player to interact.
        # The button checks if the player has herbs.
        if CraftButton.IsReady():
            # If the button is ready, we can use it.
            # The button knows to check the player's inventory.
            pass

Comments

    Sign in to vote, comment, or suggest an edit. Sign in