Verse Library verse

01 Device

Server device that spawns a client-side UI panel for each player to display local elimination counts.

verse-library/clients-panel/01-device.verse

# Revenge_Tracker.verse

# 1. IMPORT THE STUFF WE NEED
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }

# 2. THE DEVICE CLASS
# Attach this to a Verse Device actor placed in the level.
# It manages the Revenge Tracker HUD for each player.
revenge_tracker_device := class(creative_device):

    # 3. THE MAIN LOGIC
    # OnBegin fires once when the game session starts on the server.
    # We then fan out to each player locally via <runs_on_client>.
    OnBegin<override>()<suspends> : void =
        # Subscribe to player-added so late-joiners also get the HUD.
        GetPlayspace().PlayerAddedEvent().Subscribe(OnPlayerAdded)
        # Also set up HUD for any players already in the session.
        for (P : GetPlayspace().GetPlayers()):
            spawn { RunClientHUD(P) }

    # Called whenever a new player joins.
    OnPlayerAdded(P : player) : void =
        spawn { RunClientHUD(P) }

    # 4. CLIENT-SIDE HUD LOGIC

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