x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Stamina - Mulitplaer

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: alt text and here is the character BP: alt text alt text

here is the widget BP: alt text alt text

and here is a video about what happening when using dedicated server and not using dedicated server:

thanks for help.

Product Version: UE 4.14
Tags:
errors.png (18.9 kB)
stamina.png (412.1 kB)
widgetgraph.png (43.2 kB)
more ▼

asked Jul 07 '17 at 08:43 AM in Blueprint Scripting

avatar image

therealcain
11 1 2 6

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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 ;)

more ▼

answered Jul 07 '17 at 11:01 AM

avatar image

AmphDev
1.5k 15 9 33

avatar image therealcain Jul 07 '17 at 11:27 AM

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 ?

avatar image AmphDev Jul 07 '17 at 11:39 AM

On your first picture:

InputActionSprint if stamina > 0 -> set max walk speed 475 <- this is bad because this will run only on client.

Create a custom event like your Run On Server, just name it as Set Max Speed on Server (of course this need to be server rpc)

After set max walk speed happens when key is pressed and max walk speed are set call this event to set max walk speed on server too

avatar image therealcain Jul 07 '17 at 01:34 PM

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 :)

(comments are locked)
10|2000 characters needed characters left

Hey!

Some networking teach here ;)

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 ;)

more ▼

answered Jul 07 '17 at 08:59 AM

avatar image

AmphDev
1.5k 15 9 33

avatar image therealcain Jul 07 '17 at 10:39 AM

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 ).

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question