Sending Widgets Between Clients



Hey everyone! I’m Creating a Pokemon Style Game where everyone joins a dedicated server and can run around together. I have a list of Nearby players that you can invite to Battle and Trade.

However I can’t seem to get it to bring up the widget to accept or refuse the battle. If I click the battle button currently It sends the invite to the player who sent it. I tried to send the selected players state/controller to the Game State to then run it on the server.

If anyone has any ideas how this can be resolved you’d save me a lot of sleepless nights ahha

Clients can’t execute multicast RPC’s so On Clicked calling FindPlayer on The GameState will not work.

You have the right idea of using the PlayerState though since each player own their own PlayerState and can use it to send RunOnServer Events from here and every player can get a reference to all the other PlayerStates.

I would avoid the GameState in this and also avoid PlayerController references as they are not replicated to other Players.

So you could create a RunOnServer event on the PlayerState which sends the Playerstates of the opponents you want to battle and then the Server can forward a RunOnOwner RPC to the PlayerStates that needs to know so they can get a Widget pop up.

1 Like

Interesting If you wouldn’t use the Gamestate what would you use instead?

Either way this has given me some things to think about which i’ll try over the weekend thanks :slight_smile:

PlayerState is all you need.

OnButtonPressed on the inviter PlayerState should make a RunOnServer event with the invitee as a PlayerState parameter.

The Server makes a RunOnOwner RPC on the Invitee PlayerState with the inviter (self) PlayerState as a Parameter.

The Invitee can from here use the inviter PlayerState Parameter to create a Widget of who is inviting to battle.

1 Like

That makes sense! Ill give it a try over the weekend and i’ll let you know how it goes! Thank you so much for your help!

1 Like

You’re welcome. This can be quite confusing at times. Good luck and don’t hesitate with followup questions.

1 Like

So I have tried to implement what you’ve said and now instead of the invite appearing on the senders screen it appears on everyones screens. So i feel like there is progress happening at least XD haha

I feel like maybe i’m not pulling through the Player State correctly?




Yes unfortunately when you replicate a variable in Blueprint it will be replicated to everyone.

For this to work you can’t use a replicated variable but instead the server should make a RunOnOwner event on the invitee Playerstate.

1 Like

Ah okay so should i also not replicate the My Player State variable either?

If you use replicated variables then you need to set the Replication Condition of the PlayerState variable to OwnerOnly but it might be easier to just use RPC’s

1 Like

So this is how I’ve set up the Player state (Removing the Replicated Variable) and I’ve now got a Client Invite that runs on the owning Client. Now its back to showing up just on the senders screen


Almost there.

Make sure that “On invite Button Pressed” gets called on the PlayerState that you own otherwise the “Server Invite” RPC will not be called.

1 Like

Your a star thank you so much! ill try this as soon as im back at my computer.

1 Like

That got it working! Thank you so much! Now to just set up the accept fight! and move them over to the battle world :smiley:

Sorry to bother you again. I am currently working through the Accept Battle code. I wondered if I could pick you brain again. Im basically wanting the Invitee to click accept and then send each others teams to one another for a battle.

I feel like im pretty close to getting it working but currently when I click accept nothing happens. Any help would be appreciated :slight_smile:




I think the issue is my Third Person Casts they seem to always fail and im not sure why

Edit: after using Print strings I have determined the Second Pin Still executes but the MP Start event from the TPC doesnt execute

To get the BP_ThirdPersonCharacter from a PlayerState you should not use GetPlayerController and then GetOwner as this would not return a Pawn. Use GetPawn directly from the PlayerState instead.

“Accept Battle Request” also don’t need a Parameter of the JoinPlayerState as this is the same as the Target “self”.

You have a lot going on the “Accept Battle Request” event but at first glance it looks alright.

1 Like

Thank you so much your information has helped me get them through to the Battle World the only problem i have now is their team information comes through blank


You are setting the Team variable at the same time you are calling the RPC’s there is no guarantee in which order they arrive.

You should either send the team variable as a Parameter on the same RPC or make the Team variable RepNotify and react when it gets replicated.

That worked a treat! Thank you again for all your help! I can now finally get stuck into replicating all the Battle Mechanics and move forward with my project

1 Like