Download

Issue on running a GameState function from a PlayerController RPC

Hello !

I have an issue I can’t find any solution for despite all my researches.

I’m trying to set up a multiplayer card games. In my custom GameState blueprint, there is a variable “lastDrawnCard” - set to “replicated” - who refers to the last drawn card and which is updated when the pack is clicked (so a card is drawn). There is also a function which prints the last drawn card display name. When running this function from the GameState blueprint with any event, it works well.

Now in my custom PlayerController I made a custom event and set his “replicates” parameter to “run on server”. When this “run on server” event is triggered, a cast is made to the GameState, then from that cast I call the GameState function to print the drawn card. And this is not working, the printed card name is an old value.

So it seems my GameState variable is not up to date when the function that uses it is called from a PlayerController custom “run on server” event (which is a Remote Procedure Call think). Same problem when I try to trigger a GameState event instead of a GameState function from a PlayerController RPC.

Do you have any idea to solve this ?

Thanks ! :slight_smile: