MFPS version 1.8.2
I know the cause of the error, but I don’t know how to fix it.
Master launched the game*
Game started.
Master leaves the game room*
Cheking rom client.
Master connects back*
Bug on Master*
Bug on Client*
Bug with bots if the master left and returned
- Lovatto
- Admin
- Posts: 1834
- Joined: Sun Dec 07, 2014 3:18 pm
- Contact:
Hi,
Although the error is annoying it doesn't interfere with the game,
the error is caused by how the bots are destroyed, I have fixed this error but I have refactored a lot of code.
You can try this, I have resume the fix to these changes but I'm not sure if this will work as intended with just this:
in bl_AIManager.cs -> SpawnPendingBot() -> change this line:
Destroy(SpawningBots[0].gameObject);
with:
in bl_AIShooterAgent.cs -> replace the function DestroyBot(...) -> with this:
in bl_AIShooterHealth.cs -> Die(...) -> at the very bottom of the function -> replace these lines:
with these:
That should do it.
Although the error is annoying it doesn't interfere with the game,
the error is caused by how the bots are destroyed, I have fixed this error but I have refactored a lot of code.
You can try this, I have resume the fix to these changes but I'm not sure if this will work as intended with just this:
in bl_AIManager.cs -> SpawnPendingBot() -> change this line:
Destroy(SpawningBots[0].gameObject);
with:
Code: Select all
PhotonNetwork.Destroy(SpawningBots[0].gameObject);
Code: Select all
public void DestroyBot(NetHashTable data, PhotonMessageInfo info)
{
if (data.ContainsKey("instant"))
{
if(PhotonNetwork.IsMasterClient) PhotonNetwork.Destroy(gameObject);
return;
}
Vector3 position = (Vector3)data["direction"];
AIAnim.Ragdolled(position, data.ContainsKey("explosion"));
if ((PhotonNetwork.Time - info.SentServerTime) > bl_GameData.Instance.PlayerRespawnTime + 1)
{
Debug.LogWarning("The death call get with too much delay.");
}
this.InvokeAfter(bl_GameData.Instance.PlayerRespawnTime + 2, () =>
{
if(GetGameMode.GetGameModeInfo().onRoundStartedSpawn != GameModeSettings.OnRoundStartedSpawn.WaitUntilRoundFinish)
Debug.LogWarning("For some reason, this bot has not been destroyed yet.");
});
}
Code: Select all
if (PhotonNetwork.IsMasterClient)
{
if (!isOneTeamMode)
{
if (m_AIShooter.AITeam == PhotonNetwork.LocalPlayer.GetPlayerTeam())
{
GameObject di = bl_ObjectPooling.Instance.Instantiate("deathicon", transform.position, transform.rotation);
di.GetComponent<bl_ClampIcon>().SetTempIcon(DeathIcon, 5, 20);
}
}
AIManager.OnBotDeath(m_AIShooter, killerBot);
}
var deathData = bl_UtilityHelper.CreatePhotonHashTable();
deathData.Add("type", AIRemoteCallType.DestroyBot);
deathData.Add("direction", direction);
if (weaponName.Contains("Grenade"))
{
deathData.Add("explosion", true);
}
this.photonView.RPC(bl_AIShooterAgent.RPC_NAME, RpcTarget.AllBuffered, deathData);//callback is in bl_AIShooterAgent.cs
Code: Select all
if (bl_PhotonNetwork.IsMasterClient)
{
//respawn management here
//only master client called it since the spawn will be sync by PhotonNetwork.Instantiate()
AIManager.OnBotDeath(m_AIShooter, killerBot);
//Only Master client should send the RPC
var deathData = bl_UtilityHelper.CreatePhotonHashTable();
deathData.Add("type", AIRemoteCallType.DestroyBot);
deathData.Add("direction", direction);
if (weaponName.Contains("Grenade"))
{
deathData.Add("explosion", true);
}
//Should buffer this RPC?
this.photonView.RPC(bl_AIShooterAgent.RPC_NAME, RpcTarget.All, deathData);//callback is in bl_AIShooterAgent.cs -> DestroyBot(...)
}
- Moor
- Member
- Posts: 23
- Joined: Thu Apr 11, 2019 2:38 pm
Hallo, your code has fixed errors
Only throws a small error: (But I have already fixed)
bot BOT Xuan has not team
UnityEngine.Debug:LogError(Object)
bl_AIMananger:SpawnBot(bl_AIShooter, Team) (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIMananger.cs:246)
bl_AIMananger:SpawnPendingBot() (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIMananger.cs:411)
Thank u for help Lovatto.
Only throws a small error: (But I have already fixed)
bot BOT Xuan has not team
UnityEngine.Debug:LogError(Object)
bl_AIMananger:SpawnBot(bl_AIShooter, Team) (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIMananger.cs:246)
bl_AIMananger:SpawnPendingBot() (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIMananger.cs:411)
Thank u for help Lovatto.