Verse Library verse

01 Device

Checks player inventory for materials, consumes them, and awards a crafted weapon item.

verse-library/using-mineral-ore-crafting-items-in-fortnite-creative/01-device.verse

using { /Fortnite.com/Devices }
using { /Fortnite.com/Items }

# This is our crafting station device
CopperSwordStation := class(creative_device):
    # We need to know when a player presses the button
    OnPlayerActivated := event(player: player):
        # Check if the player has Rough Ore
        has_ore := player.Has_Item(Rough_Ore)
        
        # Check if the player has Coal
        has_coal := player.Has_Item(Coal)
        
        # If they have BOTH, give them a sword!
        if (has_ore and has_coal):
            # Remove the ore and coal (optional, but good for balance)
            player.Remove_Item(Rough_Ore, 1)
            player.Remove_Item(Coal, 1)
            
            # Give the player a Copper Sword
            player.Give_Item(Copper_Sword, 1)
            
            # Tell the player they succeeded
            print("You crafted a sword!")

Comments

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