Actor Clicked > Cast to Player State Custom event > Custom Event Execute on Server > Custom Event Execute Multicast >
When I test the game some times the client can properly trigger a series of custom events that replicates to all clients. But other times the client gets stuck and does not make it past the execute on server custom event. No changes. Just totally random with each time I press play to test.
Gotcha. I set the RPCâs to reliable, but the issue remains. I uploaded a video of the issue to dropbox if you want to take a look.
It will work consistently, but then suddenly the clientâs Player_State will fail to execute the âOn Serverâ RPC. It either works perfectly, or not at all. Very weird.
Did you try to also do a print directly before the RunOnServer rpc to see whether it executes the call to the server (between toggle set player state and server)?
Are you creating and hosting a session ? because I see youâre doing it as already being a client. I suggest playing with 2 standalones and not in dedicated/listen server.
Can you add a print to the cast failed because the player state is also something that gets replicated to the client, Itâs worth checking if itâs valid, maybe this fails sometimes.
I am! I was actually about to post about it. Hereâs the current set up⌠Level âMain Menuâ loads a host/join widget, âhostâ creates a session and loads the âMain Levelâ as seen below.
I changed it, still no dice. I also added a failed cast print, and a print before the server RPC.
2 Stand Alone Clients
âHostâ Player
âJoinâ Player
edit: Forgot to say, those two screen shots are separate tests. The âHostâ player will execute and the widget will replicate the green appearance on the âJoinâ player.
Right now I suspect the GetPlayerState node, I think it might not be returning the locally controlled player state, replace it with this
Actually just read the description, itâs probably it.
In multiplayer you have access to all players player state, the get player state node will return one based on index and not necessary your own player state.
Try adding this check, it should print true if that player state is yours, if it does and you still canât send the server event then something is weird going on. Also delete those new param just in case.
Interesting, thatâs weird, it could be a glitch that happens in editor only.
You can try doing the server event in the player controller and only the multicast in player state.
Execute server on player controller
Player controller access the player state and calls the muticast
Donât use get player state though, remove that node anywhere you have it. In player controller you can access it directly