+2 votes

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.

in Engine by (69 points)
retagged by

6 Answers

+1 vote

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, https://docs.godotengine.org/en/stable/classes/class_multiplayerapi.html#enumerations, by default methods are unable to be accessed by RPC calls. In order to resolve this, the docs instructs you to use the rpcconfig() 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 rpcconfig() 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.

To read more about rpc_config(), check it out here: https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-rpc-config

Hope this helps!

by (20 points)
+2 votes

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...

by (69 points)
0 votes

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.

by (14 points)
0 votes

Thank you for your response. I'll try that.

by (14 points)
0 votes

I had a similar error and fixed it like so:

# NOTE: need to set this on client(s) and server
$Sprite.rset_config("visible", MultiplayerAPI.RPC_MODE_REMOTESYNC)

then calling rset from the server works to update the variable on the client:

$Sprite.rset("visible", true)
by (18 points)
0 votes

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.

by (346 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.