Ok so I am making a simple networking FPS, and I am trying to detect when a player has been shot, I can figure out who has been shot, but after that nothing is really working…
So I have a script that just does a raycast to figure out if you shot someone, if you did, then it sends out a RPC call, to figure out who has been shot, and to cause a reaction.
This is the RPC call
@RPC
function YourDead(n : NetworkViewID, _name : String) {
if (n.isMine) {
chat.networkView.RPC("ApplyGlobalChatText", RPCMode.All, "*************" + PlayerPrefs.GetString("name") + " Has been shot by: " + _name, 1);
transform.GetComponent(GunController).hasBeenHit = true;
transform.position = GameObject.FindWithTag("Respawn").transform.position;
yield WaitForSeconds(3);
transform.GetComponent(GunController).hasBeenHit = false;
}
}
It is able to tell who has been shot, and calls the actual code inside the if statement, however the chat.networkView.RPC… is the only thing that really works. Changing the transforms position doesn’t work, and changing the boolean value doesn’t work, anyone know what I am doing wrong?