Situation is, I am doing a multiplayer networked game. I had the float variables of Health, Stamina etc within the Player Character BP. Problem is the HUD only worked for the Server. So after much research it seems I was a dummy and should instead store those variables within Player State.
So I have now set them up as variables within the player state and that’s working fine, every clients HUD is correct to the values.
New problem is as follows: I want to use the stamina system for sprinting, jumping etc… I can’t register the input from player state so how do I get the input action of Jump, to check against the value of stamina from the player state?
For example, I want to make sure say, Variable of ‘Stamina’ is greater than Variable of ‘Stamina Jump Amount’ and if True, Jump!
I managed to get it to do the check and render true or false, however this only seemed to make the server char jump but never the client.
I have tried many ways much to my distress and got nowhere. Spent hours searching and also found nothing.
Someone please save me this headache! Thanks in advance!
So I would make the float variables on the characters blue print and cast that to the playerstate or are you saying input action jump > cast to player state to call let’s say a function that gets a return node boolean of CanJump? after it checks stamina float value is greater than required stamina amount and then on the character BP use a branch to true/false that boolean?
Hope that makes sense!
Also, no matter where I store my variables, I can never seem to get my HUD widget to display the clients stats. I set up a print string that after a delay of 2 on event tick, it outputs my current health and stamina.
What I have got is in the player state, a function I aptly named “UpdateHUD” on event tick which has a reference to the widget, gets Health Bar, Stealth Bar (Progress Bars) and then sets percent based on the float values of health and stamina * 0.01.
Only ever seems to update the bars for the server or in a single player setup but the other clients all get nothing.
Help greatly appreciated! Thanks for answer ZoltanJr so far!