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"

[Multiplayer] Get player array & set it on UMG for both server/clients

The script only prints the host's player name. Clients aren't being produced on the server nor other clients.

How can I get this to work properly? Do I need to be running something on server?

Thanks in advance!

alt text

Product Version: UE 4.20
Tags:
helpplayerlist.png (183.4 kB)
more ▼

asked Aug 20 '18 at 07:05 AM in Blueprint Scripting

avatar image

Debaucher
67 1 6 8

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

1 answer: sort voted first

Player States dont all get created on the first tick. Instead of constructing your list only once when this actor is constructed, I would recommend setting your player state class to tell your list to update once the Player state Beginplay is called, on server side of course, and each time it updates server side, replicate to all clients.

more ▼

answered Dec 08 '18 at 06:24 PM

avatar image

mightyenigma
3.7k 18 23 20

avatar image Debaucher Dec 08 '18 at 07:44 PM

Thanks for the reply and advice, Enigma. I have one follow up for you. If a player leaves the game by just exiting out of the game client all together, how would I have that player removed from the list? I understand there is an option to set how long a playerstate sticks around after leaving. Would this be the option I'm looking for?

avatar image mightyenigma Dec 10 '18 at 04:34 PM

I actually dont know the answer to that question, but I would do the following:

  • in PlayerState destruct function, tell server to multicast that the list of players should update.

  • set a timer to every 2 seconds ish, multicast that the list should update. That way if a client's computer gets destroyed by a lightning bolt and therefore cannot call the destruct function, it will still update the list to remove the missing player's name.

(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