Verse Library verse

01 Fragment

Iterates through all players and logs their current team assignment for debugging.

verse-library/using-teams-and-classes-to-organize-your-game/01-fragment.verse

# This is a simple Verse script for our game
# It helps us find the teams we set up in the editor

# We create a variable for our game world
GameWorld := GetPlayspace()

# We get the list of all players in the game
AllPlayers := GameWorld.GetPlayers()

# We loop through each player
for (Player : AllPlayers):
    # We check which team the player is on
    CurrentTeam := GameWorld.GetTeamCollection().GetTeam[Player]
    
    # We print the team name to the screen
    # This is just for testing!
    Print("Player is on team: {CurrentTeam}")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in