problem: respawn possession in simulated multiplayer networking

Hey all. Lets start off with a confession - i’m not 100% comfortable with networking in blueprints :stuck_out_tongue: This may well be a simple one for those cleverer than me :slight_smile:

So, here’s the problem - i’m trying to possess a new pawn after uncolliding/hiding the old one. When i do, it always seems to change the possession of the OTHER window (i’m simulating a client and a server in 2 windows) not the one that just died. I kill from the server, suddenly i control the client. Kill from the client, suddenly i control the server. I’m confused, because printing out the name of the controller’s possessed pawn always seems to be the right one. Its like the possess node isnt working somehow, or i’m feeding it the wrong controller…

Here’s the damage function for when the pawn gets hit:


the sent event at the end executes on server.

It calls this event on the character pawn:


the end event is sent to the controller, on the server.

This is the controller script:


Again, end event on server.

And the final sequence, on the game mode:


I take the controller, spawn an new pawn and possess it.

Help would be greatly appreciated and eternal love given for preventing my grey hairs.

Cheers,
Russ

Your passing Self as the controller. Which in this case, since your event is executed on the Server, self will always be the server.

Self will be the Server Version of the Clients Controller.

Remove the logic from the GameMode. Let the Respawn happen in the Controller.

Also: Once you called an RPC from client to server, you can work with normal events.
You are calling Client->Server RPCs although you are already on the server.

Event your “OnTakeDamage” event should be on the server, since you are changing a replicated
variable. So if this is not running on the server, no one, despite the client, will notice the damage
event. So why needing an RPC (“Respawn” event for example), if you are already on the server?
You could use a switch has authority, so that the client won’t call this anyway, instead of using
multiple RPCs.

And if you leave the even in the Controller, instead of passing it to the GameMode, you don’t
need to pass any controller.