Someone know why this code doesn't work?:
remote func _damaged(direction):
velocity = direction * 200
velocity = Player.move_and_slide(velocity)
rpc_id(int(body.name), "_damaged", hit_direction)
I got "test" printed on the right player, but neither StateMachine nor velocity work. Does someone know what's happening?
get_parent() instead of
Player, but it didn't help either.
Also I tried using rsetid("velocity", hitdirection * 200), but it didn't work too
What I try to achieve is to move one player via a network, when he got hit by another player
Player is reference to
StateMachine is reference to
Edit2: I found out that if I print
func _damaged() then it shows not the player who should receive signal, but the player who sends rpc. For example when id 23112 sends
rpc_id(1, "_damaged"), in
func _damaged() in
print(get_parent()) there is printed 23112. I'm really confused right now why it happens because I got a "test" printed on the client with id 1.