Verse Library verse

01 Device

Watches for player eliminations and uses a HUD device to dynamically manage squad information visibility.

verse-library/making-a-custom-squad-view-in-unreal-editor-for-fortnite/01-device.verse

using { /Fortnite.com/Game }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }

# This is our main Game Mode. Think of it as the "Game Master" script.
squad_view_manager := class(creative_device):

    # A reference to the UI Control Device that shows our WBP_SquadView widget.
    # Wire this up in the UEFN level editor Details panel.
    @editable
    SquadUIDevice : hud_controller_device = hud_controller_device{}

    # This function runs when the game starts.
    # Think of this as the "Bus Ride" start phase.
    OnBegin<override>()<suspends> : void =
        # 1. Get all players currently in the session.
        Players := GetPlayspace().GetPlayers()

        # 2. Listen for when players are eliminated so we can react.
        # This is like a "Trigger" that fires when someone steps on it.
        for (Player : Players):
            ListenForPlayerEliminated(Player)

        # 3. Show the squad UI widget for every player via the HUD controller device.
        for (Player : Players):
            SquadUIDevice.Enable()

    # A helper function that listens for a single player's elimination event.
    ListenForPlayerEliminated(Player : agent)<suspends> : void =

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