Verse Library verse

01 Standalone

Allows players to exchange collected resources for rewards by pressing a button.

verse-library/using-world-resource-items-in-fortnite-creative/01-standalone.verse

# This script checks for Wood and gives a reward
using { /Fortnite.com/Devices }
using { /Verse.org/Sim }

# We create a new script called ResourceShop
ResourceShop := class(script):
    # This runs when the game starts
    OnBegin<override>()<suspends>: void=
        # We wait for the player to press the button
        # We assume a button device is linked in the editor
        if button_pressed:
            # Check if the player has 5 Wood
            if player_has_resource("Wood", 5):
                # Give the player a Health Potion
                give_reward("Health Potion")
            else:
                # Tell the player they need more Wood
                show_message("Need 5 Wood!")

Comments

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