Verse Library verse

01 Device

Automatically grants building tools and materials to the player's build hotbar when the island starts.

verse-library/fort-inventory-build-hotbar-component/01-device.verse

using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Fortnite.com/Itemization }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Itemization }

# This is our main script. It runs when the game starts.
BuildToolGiver := class(creative_device):

    # This runs once when the island starts.
    OnBegin<override>()<suspends>: void =
        # Get the playspace so we can find players.
        Playspace := GetPlayspace()

        # Wait until at least one player is present.
        Players := Playspace.GetPlayers()
        if (Players.Length = 0):
            return

        # Find the player who started the game.
        Player := Players[0]

        # A fort_character is needed to access inventory components.
        # GetFortCharacter[] is a failable expression, so we use 'if'.
        if (FortCharacter := Player.GetFortCharacter[]):

            # We need to talk to the player's build hotbar.
            # This gets the special "sleeve" for building tools.

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