#how can i send rpc using server and client separately?
1 messages · Page 1 of 1 (latest)
and this one on my client side
the connection seems fine, but this rpc calls returns error 31 (ERR_INVALID_PARAMETER)
the output log:
thats the node structure in both server and client, is there anything wrong?
I don't see a World node (or a World/Enemies node for that matter)
also get_tree() returns SceneTree, not the root node
for that you want to get the root property
doing "../" from root would be invalid, because root is already the bottom most, it doesn't have a way to go back one more
when i click to connect it changes the gameMenu node to World node
try changing your get node statement to get_tree().root.get_node("World/Enemies")
on the client side, it doesnt even get to print the line 6 "spawning player"
error persist on server side
what do the notifications say? there should be an error message with more detail included
ERR_INVALID_PARAMETER is returned by rpc in the following cases:
- The object trying to call the rpc isn't in the scene tree or is not a valid node
- The method is missing or is not marked for RPCs in the local script
- You're trying to RPC yourself
E 0:47:38:0292 Server.gd:25 @ _peer_connected(): Unable to get the RPC configuration for the function "spawn_player" at path: "/root/Server". This happens when the method is missing or not marked for RPCs in the local script.
<C++ Error> Condition "rpc_id == 65535" is true. Returning: ERR_INVALID_PARAMETER
<C++ Source> modules/multiplayer/scene_rpc_interface.cpp:480 @ rpcp()
<Stack Trace> Server.gd:25 @ _peer_connected()
yeah, that's the second point
try adding
@rpc
func spawn_player(player_id, location):
pass
to your server side Server.gd
and see if that works for it
i did, and got this: E 0:01:44:0627 process_confirm_path: The rpc node checksum failed. Make sure to have the same methods on both nodes. Node path: Server
<C++ Source> modules/multiplayer/scene_cache_interface.cpp:118 @ process_confirm_path()
maybe rename the location to spawn_position
but on the other hand, on my client side it printed the line 6
so it matches the server's version
that's the get_tree().root part
get_tree() returns SceneTree
get_tree().root returns the root node at the bottom of the scene tree (which is the one that has get_node())
ooh, ok, ill change and see if it works
so long as I have the same function with the same parameters in the node on either end (and it's an @rpc on both sides), it seems to work fine here
(the code of the function does not have to be the same)
(just the name and parameters)
it still gives this error ```E 0:01:21:0536 process_confirm_path: The rpc node checksum failed. Make sure to have the same methods on both nodes. Node path: Server
<C++ Source> modules/multiplayer/scene_cache_interface.cpp:118 @ process_confirm_path()
on both client and server
btw, im trying to check if the player_id is equal to the current client network id, when i doing it right if multiplayer.get_unique_id() == player_id ?