Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CodeFox |
Hello everyone,
I think I didn’t understand the documentation correctly, so I would like to know more about how to use and how the RSET works.
In my project, a multiplayer 3D topdown game, I have the following situation;
Both the Client and Host use the same interface to select a color. Once they press the “Start” button this color value is sent to a “NetworkMaster”.
The information seems to reach the NetworkMaster correctly. But only the peer manages to receive both colors correctly.
I tried using RSET (converting the Colors to string), in order to clear any incoherence between Host and Client data but it didn’t seem to work.
So how can I guarantee that both client and host have the same information stored on that playersColor variable?
Maybe this bit of code would help:
var playersColor["",""]
func set_player_info(color):
if(get_tree().is_network_server()):
rpc("setPlayerColor", 0, color);
else:
rpc("setPlayerColor", 1, color);
sync func setPlayerColor(index, color):
playersColor.insert(index, color)
if( typeof(playersColor[0]) == TYPE_COLOR &&
typeof(playersColor[1]) == TYPE_COLOR):
pass
pass
PS: When I try the RSET function it complains about not been able to convert String to Color. I thought it uses a Variant type exactly to avoid such problem. I wonder if that’s a bug or something.