Verse Library verse

05 6 Handling A Player Joining A Game In Progress

Initializes team setup, configures elimination limits, and subscribes to spawn and player join events.

extracted-snippets/documentation/en-us/uefn/team-elimination-game-6-handling-a-player-joining-a-game-in-progress-in-verse/05-6-handling-a-player-joining-a-game-in-progress.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/team-elimination-game-6-handling-a-player-joining-a-game-in-progress-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/team-elimination-game-6-handling-a-player-joining-a-game-in-progress-in-verse.md
# Section:    6. Handling a Player Joining a Game in Progress
 OnBegin<override>()<suspends> : void =
     set Teams = GetPlayspace().GetTeamCollection().GetTeams()
     set EliminationsToEndGame = WeaponGranters.Length
     Print("Number of eliminations to end game is {EliminationsToEndGame}")
     Print("Beginning to assign players") 
     PopulateTeamsAndPlayers()   
     for (Spawner : PlayerSpawners):
         Spawner.SpawnedEvent.Subscribe(OnPlayerSpawn) # Subscribe to each player spawn pad
     for (Sentry : Sentries):
         Sentry.EliminatedEvent.Subscribe(TestPlayerEliminated) # Subscribe to each Sentry
     # Subscribe to new players joining the game
     GetPlayspace().PlayerAddedEvent().Subscribe(OnPlayerAdded)
Copy full snippet

Comments

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