Verse Library verse

01 Standalone

Modifies player character materials to display blue or red based on player ID for visual distinction.

verse-library/triad-infiltration-9-creating-visual-aids-in-verse/01-standalone.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Symbols as Engine }

# This is our main script. It runs on the island.
TeamVisuals := class(VerseWorld):
    # This runs when the game starts.
    OnBegin<override>()<suspends>:
        # We watch for players joining the game.
        # The 'For' loop checks every player slot.
        For Player : Player in World.GetPlayers():
            # We start a background task for this player.
            Spawn ChangePlayerColor(Player)

    # This function changes the color.
    # It takes a Player as input.
    ChangePlayerColor(Player : Player):
        # We find the player's character mesh.
        # This is the 3D model of their body.
        Mesh := Player.GetMesh()
        
        # We check if the mesh exists.
        If Mesh:
            # We pick a color based on the player ID.
            # Even IDs get Blue. Odd IDs get Red.
            Color := If Player.GetId() % 2 == 0, 
                Engine.LinearColor{R:0.0, G:0.0, B:1.0, A:1.0}, 
                Engine.LinearColor{R:1.0, G:0.0, B:0.0, A:1.0}
            
            # We apply the color to the material.

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