Replicated Stamina

Hello,

I made a multiplayer game in which the player has a stamina value changing when he runs. The variable is in the player bp and I’m calling a server event to change it… However, when the Host loses stamina, the client loses some too; and when the client loses some, nothing happens; it’s resetting to 100%.

What am I doing wrong?
Thanks.

This happens when your client is not using an RPC call to update the server, so then the server just overwrites the value on the client. Can you post a screenshot of how you are calling the server from the client when the client loses stamina?

Here are the pics. Sorry it’s a.zip file, couldn’t put em all here.

Ok, here is what seems odd to me. In Capture4,png Gain Endurance and Lose Endurance are set to replicate to server, but you are already on the server side. This could either not work entirely or create a timing issue. Try changing these two events to not replicate. I’m not sure what Endurance to Blur does, so I don’t know if that is affecting you.

The delay in your Lose Endurance event could also be causing you timing issues. I would try changing the Gain Endurance and Lose Endurance events first, but if that doesn’t work, take a look at the Delay node. Try removing it for testing. If that fixes it, try changing the Delay to a Set Timer node.

Also, just a personal preference of mine, but I do not use Event Tick. In theory I guess there might be times when you need it, but I have always found a way to do the same thing without using Event Tick. If used incorrectly, Event Tick can be a performance nightmare. So just something to keep in mind if you run into performance issues. In your case it probably isn’t having any effect.