Handling Late Player Joins in Verse
When a player joins a game in progress, you don’t want them to have to wait as a spectator for a new round to start. Ideally, a new player should be able to spawn and start playing immediately. To handle this, you need to add the new player to TeamMap, subscribe to their elimination event, and grant them their first weapon.
Follow these steps to grant players weapons and subscribe to their player events when they join a game in progress.
-
Add a new method
OnPlayerAddedto theteam_elimination_gameclass. This method promotes any player that joins the game in progress to the lowest weapon tier of another player on the team.| | | | --- | --- | | | OnPlayerAdded(InPlayer : player) : void = | | | Print("A New Player Joined!") |OnPlayerAdded(InPlayer : player) : void = Print("A New Player Joined!")
Copy full snippet(2 lines long)
-
Get the team for the new player using
GetTeam[]and store it in a local variableTeam. Retrieve theFortCharacterfor that player and save it in a variableFortCharacter.| | | | --- | --- | | | OnPlayerAdded(InPlayer : player) : void = | | | Print("A New Player Joined!") | | | if: | | | Team := GetPlayspace().GetTeamCollection().GetTeam[InPlayer] | | | FortCharacter := InPlayer.GetFortCharacter[] |
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.