Verse Library verse

08 Mapping Teams Of Players

Iterates teams to populate player tier maps, subscribes to elimination events, and links them.

extracted-snippets/documentation/en-us/uefn/team-elimination-game-4-tracking-players-using-maps-in-verse/08-mapping-teams-of-players.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/team-elimination-game-4-tracking-players-using-maps-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/team-elimination-game-4-tracking-players-using-maps-in-verse.md
# Section:    Mapping Teams of Players
 PopulateTeamsAndPlayers() : void =
     Print("Beginning to populate players")
     for (Team : Teams, TeamPlayers := GetPlayspace().GetTeamCollection().GetAgents[Team]):
         var PlayerMap : player_map = map {}
         for (Agent : TeamPlayers, TeamPlayer := player[Agent], FortCharacter := Agent.GetFortCharacter[]): 
             if(set PlayerMap[TeamPlayer] = 0, WeaponTier := PlayerMap[TeamPlayer]): 
                 Print("Assigned Player to PlayerMap with Tier {WeaponTier}")
             FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated) 
         if(set TeamMap[Team] = PlayerMap):
             Print("Successfully set this team in the TeamMap")
Copy full snippet

Comments

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