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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Player list in Multiplayer

I want to make an array of players currently in a session in multiplayer. the array itself will contain a wee bit of data, such as username of the players.

The problem is that the players currently only have the username locally on their clients, and it's stored in the GameInstance, because that persist through level changes and joining of sessions.

GameInstance would seem like the most logical place to put the array of players, but each player seem to create his own array, containing only themselves... Is there anywhere else to put the array, or alternatively make it work in GameInstance?

Product Version: Not Selected
Tags:
more ▼

asked Mar 19 '15 at 11:13 AM in Blueprint Scripting

avatar image

Spoki0
30 5 6 7

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

1 answer: sort voted first

Use the replicated "PlayerState" for this. The PlayerState class already contains PlayerName and the UniqueID Variable. These variables are replicated as well as the PlayerState itself.

Also the GameState has an Array called "PlayerArray" in which all PlayerStates can be found. This is also replicated.

You can also create your own PlayerState and GameState class/BP. If you have done this there is one little tricky thing to do. The GameState can be set under "Maps and Nodes" where you also set your Playerclass, HUD, Controller, GameMode etc. You can find it under Project Settings:

wwwe

To set your own PlayerState, you need your own GameMode (you can set this up in the Maps and Nodes too, like i said above). After you created your GameMode and PlayerState BP, you need to OPEN the GameMode BP and click on "Class Defaults" at the top. After that, you will have the options on the right side showing:

wewe

As you can see, there you can set your PlayerState (:

I hope that helps!

More information about the PlayerState:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/APlayerState/index.html

More information about the GameState:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AGameState/index.html

more ▼

answered Mar 19 '15 at 01:16 PM

avatar image

eXi
6.8k 332 184 467

avatar image Spoki0 Mar 19 '15 at 03:12 PM

Thanks, that seems to have solved things. Just again tricky with having to save the variables to the PlayerState.

avatar image leofucci Dec 19 '18 at 06:06 PM

Can you please explain, who is in charge to add player to this PlayerArray? For me is always empty, should I add myself and others?...also which place should be the best place to do this?

(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