Godot Version
4.2.2 stable
Question
ok this is my script so that it works BUT with no restrictions
extends Node
func Call():
print("call 1 on local client")
SrvCall.rpc_id(1, multiplayer.get_unique_id())
@rpc("any_peer", "reliable")
func SrvCall(id):
print("call 2 on server")
CallLocalPlayer.rpc_id(id, id)
@rpc("any_peer", "reliable")
func CallLocalPlayer(id):
print("WORKS ", id)
I want to know how to make it work that only server can receive the call → SrvCall
or only local player can recieve call only from Server → CallLocalPlayer
I was trying to play with "authority", "call_local", "call_remote",
but always hit a wall with a error which I don’t even understand
the authority and server client calls are done like this:
func Server():
netManager.create_server(PORT)
multiplayer.multiplayer_peer = netManager
AddNetworkNode(1)
multiplayer.peer_connected.connect(
func(new_peer_id):
await get_tree().create_timer(1).timeout
AddNetworkNode.rpc(new_peer_id)
)
func Client():
netManager.create_client(ADDRESS, PORT)
multiplayer.multiplayer_peer = netManager
await get_tree().create_timer(2).timeout
localNetworkNode.Call()
## general network node for all players
@rpc
func AddNetworkNode(id):
print("empty call to older clients")
## if the id is my id I'll populate my self and not the others I don't want to care about them now
if id == multiplayer.get_unique_id():
localNetworkNode = preload("res://Networking/Client/NetworkNode.tscn").instantiate()
map.add_child(localNetworkNode)
localNetworkNode.set_multiplayer_authority(id)
print("the id: ", id)
if you really need that kind of errors please let me know.
I didn’t provide them because I think you know out of the box what to do from Info I provided.