Verse Library verse

01 Device

Configures maximum players and team size at match start using the Island Settings device.

verse-library/1-create-a-new-project/01-device.verse

# This is a simple Verse script for Island Settings
# It runs when the game starts

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

# We define a class that holds a reference to our island settings device.
# In UEFN, you bind devices by placing this class as a Verse device
# in the level and wiring the property in the Details Panel.
my_first_settings := class(creative_device):

    # This property is wired to the Island Settings device in the editor.
    @editable
    IslandSettings : island_settings_device = island_settings_device{}

    # OnBegin runs automatically when the game session starts.
    OnBegin<override>()<suspends> : void =
        # Set the max players to 4
        # note: island_settings_device exposes SetMaxPlayers() for runtime
        # control of the player cap.
        IslandSettings.SetMaxPlayers(4)

        # Set team size to 4
        # note: cooperative vs. competitive mode is configured in the
        # Island Settings device Details Panel; there is no SetTeams() API.
        IslandSettings.SetTeamSize(4)

        # Print a message to the output log
        # This helps us know the code ran

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