Hello,
I have a system in place where if one player is on the enemy team and another player wats to be on that team they can request to “swap” This should send a message to the person on that team telling them which player wants to swap.
For whatever reason everything works fine for when the server is on the enemy team and a client wants to swap, but if its vice vera something weird happens.
About halfway through the back and forth of carrying over information, one of my events just loses its variable information. (a controller type). Its better if I explain with pictures.
Not that all of these functions and events carry over the “person requesting” variable for future reference. In this function I’m checking who is the killer and then through the client’s controller, sending the request.
Is this really in the widget ?
Widgets are not replicated. You cannot RPC from client to server in a widget blueprint.
It may only work if client is a server (ie. host).
I don’t know how you manage your “Connected Players” variable, but chances are it doesn’t function in the same way as the GetPlayerController node does.
In completion branch, try to Get(index) from your ConnectedPlayers array instead.
Clients do not know about other player’s PlayerController, so this is not surprising.
Any PlayerController variable will become null when replicated to a client, except if it’s the client’s own playercontroller.
Instead, you should pass the PlayerState which is designed to be shared across all network.
Ah! thank you, I actually didn’t know that. So I would need to change the variable on “requesting player” to a player state. From that ill reference the controller. I will try this later and update the thread!