# Source URL: https://dev.epicgames.com/community/snippets/7NN4/fortnite-team-selection-and-counting-devices-that-reference-spawn-points-and-teleporters
# Local doc: epic-docs/community/snippets/7NN4/fortnite-team-selection-and-counting-devices-that-reference-spawn-points-and-teleporters.md
# Team Management Device
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
team_management_device := class(creative_device):
@editable TeamChoiceTeleporter : teleporter_device = teleporter_device{}
@editable TeamPlayerCounter : team_player_counter_device = team_player_counter_device{}
@editable var TeamID : int = 1
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
TeamChoiceTeleporter.EnterEvent.Subscribe(ChooseTeam)
return
ChooseTeam(AgentIn : agent) : void =
Print("Team Chosen.")
TeamCollection := GetPlayspace().GetTeamCollection()
Teams : []team = TeamCollection.GetTeams()
TeamPlayerCounter.DecrementAgentTeamCount(AgentIn)
if (TeamCollection.AddToTeam[AgentIn, Teams[TeamID-1]]):
TeamPlayerCounter.IncrementAgentTeamCount(AgentIn)
Expand code Copy full snippet(27 lines long)
* ```
# Team player counter device
using { /Fortnite.com/Devices }
Verse Library
verse
01 Snippet
Devices that assign players to teams and track live team member counts for multiplayer matches.
extracted-snippets/community/snippets/7NN4/fortnite-team-selection-and-counting-devices-that-reference-spawn-points-and-teleporters/01-snippet.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.