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"

Client Playerstate in HUD sometimes invalid

Hi!

im trying to get playerstate in my HUD's BeginPlay(). Sometimes, in PIE multiplayer with multiple players, playerstate is invalid.

This problem never occurs server-side. With 2 players it does sometimes (maybe 1 of 10 times) on clientside. With 10 player it occurs every time with every player.

I can reproduce this problem in a new project (with startercontent). Just add a new HUD BP with this: alt text

Im probably doing something wrong, but what am i missing? Thanks for you help!

Product Version: Not Selected
Tags:
capture1.png (96.3 kB)
more ▼

asked Dec 14 '14 at 09:56 PM in Blueprint Scripting

avatar image

byte3
128 5 7 19

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

EventBeginPlay might be too early to access a playerState. in your GameMode blueprint, you can use EventPostLogin() to know when a player is finished being set up properly, so it should have a playerState by that point.

more ▼

answered Dec 15 '14 at 05:39 AM

avatar image

ScottSpadea
9.6k 320 205 450

avatar image byte3 Dec 15 '14 at 08:25 AM

Im using EventBeginPlay from inside my HUD Blueprint to display some information. Afaik EventPostLogin() in GameMode is not available client side (Gamemode runs only on server).

Im thinking i could display some dummy information in HUD/EventBeginPlay. Then when EventPostLogin in GameMode fires i send some signal back to the client to update this information.

Im at work right now. I'll give it a try in about 7 hours.

avatar image byte3 Dec 15 '14 at 09:31 PM

I tried a lot of things today.. most of them did not work.

In EventPostLogin() i send a signal back to the connected client - PlayerState was still invalid. Then i tried EventBeginPlay() in HUD, Playerstate, GameMode, PlayerController, GameState, PlayerPawn - Payerstate was always invalid.

Kind of strange that in EventBeginPlay() in PlayerState the Playerstate was invalid.

But i found something that worked. Its EventTick() in Playercontroller. Looks like a hack: alt text I feel dirty now -_-

The reason behind this might be that playerstate is replicated and it just takes some time to arrive at the client.

capture2.png (83.9 kB)
avatar image ScottSpadea Dec 16 '14 at 08:42 AM

i did a similar thing, but instead of using PlayerController's EventTick() i kept checking for it in myHud's EventRecieveDrawHud():

alt text

I was hoping EventPostLogin() would work, but i guess the PlayerState just shows up late without letting anyone know.

avatar image byte3 Dec 17 '14 at 09:28 PM

I ended up doing it your way. Thanks for your help!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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