Hello,
Iv’e been trying to create a stamina bar ( with no dedicated server and 1 player).
and the stamina doesn’t working when running… and the editor giving me the following errors:
Thank you so much! the stamina is changing now but the running problem is still existing. same as in the video first part ( not running and flickering screen ).
sorry but i don’t completely understanding you ( multiplayer is kind of new to me ). by modify you mean ‘Set Max Walk Speed’ ? or Events Replications ?
Thank you so much!
btw, i created the custom event with server rpc like you said and i added to it Input which is float and put the event with ‘Set Max Walk Speed’ on pressed and released and change the float number by the number your character is moving. ( for people that might get it helpful ). and again thank you
No matter if you using dedicated server or just play with two player without dedicated server (in this case we talkig hosted/listen server) in every solution always will be one authorative server.
In dedicated mode is the server itself
In listen server mode is the first client.
Two main problem you did.
First:
Dedicated servers will not have any render data, so when you play in dedicated server mode you need to create your widget only on client (has authority node).
Second:
You creating widget in BEGIN PLAY! begin play will be executed in every client and server.
What that means?
If you play with two player (no matter if dedicated or not, multiplayer ), two begin event will be called on server because there is two live character are present.
On Client 1 again two begin play will be executed, because one for owned pawn and one for simulated character (other player)
On Client 2 again two begin play will.be executed, because owned and simulated pawn
Basically pawns are exist in every client and after spawn engine will call begin play event, but because simulated pawns (other players) do not have player controller (because only local player have their player controller) engine cant create widget and add to viewport
You can simply fix this with IsLocalPlayer node after you fixed server bug what i told you before…
So concept is this. Put HasAuthority node after begin play, on remote branch check IsLocalPlayer and if true add widget
Yeah, you need modify walking speed on client and on Server too.
Currentky you modify only on client when sprint presses
This will modify the max speed on client and client try run faster but on server you have old max speed, so server will restrict that speed to old value.
This is why you see flickering