Photon Server settings And Pun Rpc Broken.

Options
im gonna cover most of the bugs in photon which prevents me from testing it with my friend, im using unity 2017.4.7f1 and im using the latest version of photon

Comments

  • Also. When i builded the project, I went on the editor, And there was a blank player but it was at 0.0.0, everytime it tried to move it would try to but still go to 0.0.0
  • How can i fix this, Any suggestion?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Federico123,

    Thank you for choosing Photon!

    You need to fix the error
    "ERROR You have missing MonoBehaviours on your gameobjects!"

    You are either not attaching MonoBehaviours that implement the RPCs "networkAddMessage" to the same GameObject as the PhotonView in the scene and "DoSwapTeams" to the same GameObject as the PhotonView on the network instantiated prefab or destroying them too early.
  • JohnTube said:

    Hi @Federico123,

    Thank you for choosing Photon!

    You need to fix the error
    "ERROR You have missing MonoBehaviours on your gameobjects!"

    You are either not attaching MonoBehaviours that implement the RPCs "networkAddMessage" to the same GameObject as the PhotonView in the scene and "DoSwapTeams" to the same GameObject as the PhotonView on the network instantiated prefab or destroying them too early.

    Ok, I will try to fix this and later update if it works or if not or if theres a bug.
  • JohnTube said:

    Hi @Federico123,

    Thank you for choosing Photon!

    You need to fix the error
    "ERROR You have missing MonoBehaviours on your gameobjects!"

    You are either not attaching MonoBehaviours that implement the RPCs "networkAddMessage" to the same GameObject as the PhotonView in the scene and "DoSwapTeams" to the same GameObject as the PhotonView on the network instantiated prefab or destroying them too early.

    Didnt work. Removed the missing scripts and added the new ones and not working.
  • JohnTube said:

    Hi @Federico123,

    Thank you for choosing Photon!

    You need to fix the error
    "ERROR You have missing MonoBehaviours on your gameobjects!"

    You are either not attaching MonoBehaviours that implement the RPCs "networkAddMessage" to the same GameObject as the PhotonView in the scene and "DoSwapTeams" to the same GameObject as the PhotonView on the network instantiated prefab or destroying them too early.

    Didnt work. Removed the missing scripts and added the new ones and not working.
    The missing script was just some shooting thing for gun
  • Federico123
    edited September 2019
    Options
    this is where im getting the errors, at [RPC]

    	[RPC]
    	void networkAddMessage(string killer, string killed, string middleText, string teamName){
    		Color killerColor = new Color();
    		Color killedColor = new Color();
    		if(rmm.gameMode == "TDM"){
    			if(teamName != ""){
    				if(teamName == rmm.team_1.teamName){
    					killerColor = rmm.team_1_Color;
    					killedColor = rmm.team_2_Color;
    				}else{
    					killerColor = rmm.team_2_Color;
    					killedColor = rmm.team_1_Color;
    				}
    			}else{
    				killerColor = Color.white;
    				killedColor = Color.white;
    			}
    		}else{
    			killerColor = rmm.team_1_Color;
    			killedColor = rmm.team_1_Color;
    		}
    		whoKillWho.Add(new WhoKillWho(killer, killed, middleText, killerColor, killedColor, 30));
    		//Message count limit
    		if (whoKillWho.Count > 5)
    			whoKillWho.RemoveAt(0);
    	}
    
    	[RPC]
    	void SendChatMessage(string text, string teamName, PhotonMessageInfo info){
    		AddMessage("  " + info.sender + ": ", text, teamName);
    	}
    
    	[RPC]
    	void DoDamage(float damage, PhotonPlayer player)
    	{
    		if (weKilled)
    			return;
    		if (currentHp > 0 && photonView.isMine)
    		{
    			this.StopAllCoroutines();
    			StartCoroutine(doCameraShake());
    		}
    
    		fadeValueB = 2;
    		currentHp -= damage;
    
    		//We got killed
    		if (currentHp < 0)
    		{
    			//Deactivate all child meshes
    			for (int i = 0; i < transform.childCount; i++)
    			{
    				transform.GetChild(i).gameObject.SetActive(false);
    
    
    
    
    			}
    
    			//Spawn ragdoll
    			GameObject temp;
    			temp = Instantiate(ragdoll, transform.position, transform.rotation) as GameObject;
    
    			if (!photonView.isMine)
    			{
    				temp.SendMessage("clearCamera");
    
    				if (PhotonNetwork.player == player)
    				{
    					//Send death notification message to script WhoKilledWho.cs
    					networkObject.SendMessage("AddKillNotification", gameObject.name, SendMessageOptions.DontRequireReceiver);
    
    					//Add team score
    					int teamScore = new int();
    					if ((string)PhotonNetwork.player.customProperties["TeamName"] == rmm.team_1.teamName)
    					{
    
    
    
    						//Add 1 kill for our player
    						int totalKIlls = (int)PhotonNetwork.player.customProperties["Kills"];
    						totalKIlls++;
    						Hashtable setPlayerKills = new Hashtable() { { "Kills", totalKIlls } };
    						PhotonNetwork.player.SetCustomProperties(setPlayerKills);
    
    					}
    
    					if ((string)PhotonNetwork.player.customProperties["TeamName"] == rmm.team_2.teamName)
    					{
    
    
    						teamScore = (int)PhotonNetwork.room.customProperties["Team1Score"];
    						teamScore--;
    						Hashtable setTeam1Score = new Hashtable() { { "Team1Score", teamScore } };
    						PhotonNetwork.room.SetCustomProperties(setTeam1Score);
    
    
    
    						//Add 1 kill for our player
    						int totalKIlls = (int)PhotonNetwork.player.customProperties["Kills"];
    						totalKIlls++;
    						Hashtable setPlayerKills = new Hashtable() { { "Kills", totalKIlls } };
    						PhotonNetwork.player.SetCustomProperties(setPlayerKills);
    
    					}
    				}
    			}
    			else
    			{
    				//print ("We got killed");
    				temp.SendMessage("RespawnAfter");
    				Hashtable setPlayerTeam = new Hashtable() { { "TeamName", "Zombies" } };
    				PhotonNetwork.player.SetCustomProperties(setPlayerTeam);
    
    
    				//We was killed, add 1 to deaths
    				int totalDeaths = (int)PhotonNetwork.player.customProperties["Deaths"];
    				totalDeaths ++;
    				Hashtable setPlayerDeaths = new Hashtable() { { "Deaths", totalDeaths } };
    				PhotonNetwork.player.SetCustomProperties(setPlayerDeaths);
    				//Destroy our player
    				StartCoroutine(DestroyPlayer(0.2f));
    
    				if (PhotonNetwork.player == player)
    				{
    					//Our player fell down
    					networkObject.SendMessage("PlayerFellDown", PhotonNetwork.player.name, SendMessageOptions.DontRequireReceiver);
    					teamLives = (int)PhotonNetwork.room.customProperties["Team1Score"];
    					teamLives--;
    					Hashtable setTeam1Score_fell = new Hashtable() { { "Team1Score", teamLives } };
    					PhotonNetwork.room.SetCustomProperties(setTeam1Score_fell);
    
    				}
    
    			}
    			currentHp = 0;
    			weKilled = true;
    
    		}
    	}
    
    
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Federico123,

    [RPC] is obsolete. Use [PunRPC] instead.
    So replace all those occurrences and try again.
  • JohnTube said:

    Hi @Federico123,

    [RPC] is obsolete. Use [PunRPC] instead.
    So replace all those occurrences and try again.

    Ok.
  • JohnTube said:

    Hi @Federico123,

    [RPC] is obsolete. Use [PunRPC] instead.
    So replace all those occurrences and try again.

    It Fixed :)
  • JohnTube said:

    Hi @Federico123,

    [RPC] is obsolete. Use [PunRPC] instead.
    So replace all those occurrences and try again.

    But 2 bugs aren't fixed, The room bug which if i make a room my friend cant see it or if he joins in the editor his model is invisble but in his visual he is moving, the model wont move, same thing with me, he cant see me.
  • JohnTube said:

    Hi @Federico123,

    [RPC] is obsolete. Use [PunRPC] instead.
    So replace all those occurrences and try again.

    tried fixing it, didnt work
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Federico123,

    The issue or issues you are trying to report and describe are not clear.

    I suggest you open a new forum discussion per separate issue.
    And give us all the necessary information to reproduce and investigate.
    The required information is listed here.
  • JohnTube said:

    Hi @Federico123,

    The issue or issues you are trying to report and describe are not clear.

    I suggest you open a new forum discussion per separate issue.
    And give us all the necessary information to reproduce and investigate.
    The required information is listed here.

    Okay.