Verse Library verse

08 Mapping Teams Of Players

Assigns weapon tiers to players, subscribes to elimination events, and stores team data for tracking.

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

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/team-elimination-4-tracking-players-using-maps-in-verse
# Local doc:  epic-docs/documentation/en-us/fortnite/team-elimination-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")

Comments

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