Verse Library verse

01 Device

Implements a crafting mechanic that consumes player items to grant rewards or trigger actions.

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

# We need to import the systems that handle items and players.
# Think of this like grabbing your tools from the shed before starting work.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Items }
using { /Fortnite.com/Players }

# This is our main script. It lives on the device.
# 'This' refers to the device itself.
dino_egg_crafter := class(creative_device) {
    # We need a reference to the Item Granter that gives the reward.
    # In UEFN, you link this in the editor, but in Verse, we assume 
    # we have a way to find it. For this tutorial, let's assume 
    # we are checking the player's inventory directly.

    # The main function that runs when the player presses the button.
    # 'Player' is the person who pressed it.
    OnPlayerActivate(Player : agent) : void = {
        # 1. CHECK: Does the player have a White Dino Egg?
        # We look at the player's inventory.
        # 'Has_Item' is a check, like looking in your pockets.
        # NOTE: Direct inventory checks and item consumption are not
        # available via a simple API in Verse/UEFN. In practice you
        # would wire up item_granter_device and trigger_device in the
        # editor. The logic below illustrates the lesson's intent.

        # 2. ACT: If they have it...
        # (Item presence check placeholder — wire devices in the editor)
        if (fort_player := Player as fort_playercharacter?) {
            # 3. CONSUME: Remove the egg from their inventory.
            # This is the magic part. The egg is gone. Poof.

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