How to change the player's team as soon as he dies ? And Display the number of players in each team.

Support for MFPS 2.0 (for verified users)
Forum rules
To request support/assistance for MFPS, you first have to verify your purchase by sending your purchase invoice number to Lovatto in a PM.
Post Reply
User avatar
maxdace666
New Member
New Member
Posts: 1
Joined: Fri Nov 27, 2020 3:38 am

Hello, I am currently working on a project, however the documentation does not help much.

How could I make sure that if the players of team 1 dies automatically go to team 2

And also commits to display the number of players in each team.
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Hi,

I'll give you what you need to achieve what you described,
You can know the team of the local player with:

Code: Select all

PhotonNetwork.LocalPlayer.GetPlayerTeam()
you can use to know the current team of the player and decide in which team spawn after die.

You can get the list of all players in a specific team with:

Code: Select all

 var playersInTeam1 = PhotonNetwork.PlayerList.GetPlayersInTeam(Team.Team1);
You can use for display the players of each team.

You can change the player team and spawn the player in that team with:

Code: Select all

 bl_GameManager.Instance.SpawnPlayer(Team.Team1);
The function called when a player die is located in bl_PlayerHealthManager.cs -> Die(...)

I hope that helps.
How to find your Invoice Number: Here
How to find your Order Number: Here
Post Reply