- Home /
Other
Networked if statement
Okey, I have small problem with multiplayer. I need if statement that works like this: When player 1 and player 2 are both in same room at the same time, something happens. So basically like this:
 if(Player1 == true && Player2 == true){
 Something();
 }
(not real code, just example)
Max player amount is 2 so not need to think other players. I can use RPC:s, but I dont know how I can make thing like that with RPC:s.
EDIT: Okey.. I think I just thinked this way too complicated way, I can do this even without networking :).
Answer by valax · Dec 30, 2012 at 05:45 PM
Hey. I'm not sure if this is what you mean but this is what I was thinking:
 if(Player1 == true && Player2 == true){
 
     networkView.RPC("DoSomething", RPCMode.All, "Hello"); //Sends "Hello" in the "DoSomething" RPC to everyone who is connected.
 }
 
 @RPC
 function DoSomething (message : String){
 
     Debug.Log(message);
     //Prints "Hello" to the console for both players
 
 }
Sorry if this isn't what you mean.
No, not really. I know how I can use RPC:s, but maybe I didnt explain well enough. I update first post soon.
Follow this Question
Related Questions
Networking RPC calls never sent to other clients 1 Answer
RPC Call doesnt get called 2 Answers
Networked Piano 0 Answers
Displaying players name above in multiplayer 1 Answer
Rpc Can't be called on client - Problem with client, works on server 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                