Verse Library verse

01 Fragment

Checks player inventory for specific parts, consumes them, and grants a crafted reward item.

verse-library/using-mechanical-crafting-items-in-fortnite-creative/01-fragment.verse

# This script checks if a player has the required parts and grants a reward.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Player }
using { /Verse.org/Simulation }

# Define the script as a component for a device (like a Trigger)
MechanicalCraftingScript := script() {

    # This runs when the script starts
    OnStart: virtual function () {
        # We don't need to do much here for a simple check
    },

    # This function is called when a player enters the trigger zone
    OnBeginPlay: virtual function (self: MechanicalCraftingScript, player: Player) {
        
        # CHECK: Does the player have the Rusty Part?
        # 'HasItem' is a function that checks the player's inventory.
        # Think of it like checking your pockets for keys.
        has_rusty := player.HasItem("Rusty Mechanical Part", 1)
        
        # CHECK: Does the player have the Simple Part?
        has_simple := player.HasItem("Simple Mechanical Part", 1)

        # LOGIC: If they have BOTH...
        if (has_rusty and has_simple) {
            
            # REMOVE: Take the items away (consumption)
            # This is like using a potion. The item is gone.

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