So, in my code there are 4 created players on stage. Control over each player is given to another player. First, the server gives control, and then the client.
I make a script:
enter code here> if get_tree().is_network_server(): # # For the server, give control of players to the other peers.
if players >= 2:
player2.set_network_master(get_tree().get_network_connected_peers()[0])
if players >= 3:
player3.set_network_master(get_tree().get_network_connected_peers()[1])
if players >= 4:
player4.set_network_master(get_tree().get_network_connected_peers()[2])
else : ## For the client, give control of players to itself.
if players >= 2:
player2.set_network_master(get_tree().get_network_unique_id())
if players >= 3:
player3.set_network_master(get_tree().get_network_unique_id())
if players >= 4:
player4.set_network_master(get_tree().get_network_unique_id())
The server gives control correctly, but the client does not receive correctly. As a result, customers control 3 players at once. It is LAN-wifi game. I dont know how correctly give control to he clients. Sorry for my English. Thanks in advance!