Topic was automatically imported from the old Question2Answer platform.
Asked By
patlol
Hello, I’m in multiplayer, I want to update a variable from the server to the clients or from one client to the server and the other clients. So I use rset :
rset("dictDocks", dictDocks)
dictDocks being already updated locally. And I get this error message:
ERROR: _process_rset: RSET 'dictDocks' is not allowed on node /root/Carte/LesPorts/3 from: 1. Mode is 0, master is 1.
Whether the transmitter is the master or the puppet. I don’t understand at all what that means…
Thank you.
To my limited understanding of the engine, this is caused by the fact that the dictDocks function is not able to control a function on another client/the server. According to the Godot docs, MultiplayerAPI — Godot Engine (stable) documentation in English, by default methods are unable to be accessed by RPC calls. In order to resolve this, the docs instructs you to use the rpc_config() function, that takes another method as its argument (expressed as a string) and then an int declaring its mode. According to the docs, the default mode is 0, which makes it unavailable to remote access. (The source of the error, I expect). In order to solve this most simplistically, use the rpc_config() function as such: rpc_config(“dictDocks”, 1), to set it as a remote function that may be accessed by other clients. You can get more specific with Master and Puppet modes, but that’s frankly beyond my understanding at the moment.
Thank you for your response. I’ll try that.
But in the doc they talk about method and not property. void rpc_config ( String method, RPCMode mode )
while rset is intended for property. void rset ( String property, Variant value )
That’s exactly what I don’t understand. It’s a property I want to update…
I may not be understanding the issue entirely and this is a late response however I’ll try helping anyways. If you want to call a function with ‘rpc’ or change a variable with ‘rset’ you must declare that function or variable to be either ‘remote’ or ‘remotesync’ on instantiation. for example you cannot change ‘var dictDocks’ however you can change ‘remote var dictDocks’. Also if you always want to run the function or update the variable locally at the same time then you should use ‘remotesync’ instead of ‘remote’. It is also worth remembering that references passed this way won’t work so if you end up needing to transfer an array then use the duplicate command. I hope this helps.
In C#, I found that this also occurs if you are calling a remote rpc call on a “static” function. You either have to remove the “static” keyword, or rpc_config the static function.