- Home /
Muliplayer Team System?
Hi, How do I implement a team system in a multiplayer game? (eg : when you start a level,something like team deathmatch, you get to choose betwen two teams?( In JS) Thanks!
Answer by Dissolver84 · Jun 13, 2012 at 11:50 AM
You can make a GUI script as the player join the game or server. Create two GUI buttons which shows 2 teams that the player would choose. If the player click on one of them, you can spawn a prefab(with a tag possibly) which links to the "TeamScore" script when kill someone. This script is not tested:
var playerTeam1 : Transform;
var playerTeam2 : Transform;
var spawnpoint1 : GameObject;
var spawnpoint2 : GameObject;
function OnGUI () {
if (GUI.Button (new Rect(10, 10, 100, 30), "Team Name1")) {
Network.Instantiate(playerTeam1, spawnpoint1.transform, spawnpoint1.rotation);
}
if (GUI.Button (new Rect(10, 50, 100, 30), "Team Name2")) {
Network.Instantiate(playerTeam2, spawnpoint2.transform, spawnpoint2.rotation);
}
}
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
How can I assign every connecting player to one of two teams, so that both teams are balanced? 2 Answers
How do you make teams in a multiplayer game? 1 Answer
How do I setup a specific Multiplayer game where there are rounds and teams? 1 Answer
Making a team based multiplayer game with Unet but problem with making teams 0 Answers