Getting All Player Controllers

How can I get each player controller from the game mode blueprint? (from server’s instance)

1 Like

Well you could just count all player controllers present, and then iterate through them. A little example of what I mean:

&stc=1

1 Like

^Doesn’t work on a client.

That’s true, but he wants to do it from server’s instance, and that way it should work.

I found a way yesterday, and have now worked around everything else in weird ways! My method: Setup a BP to serve as the gamestate, then access that from the client, and use its instance of the “player array.” (just get the array length)

Also, sorry about all of the posts, but its only my second day, project, and time, using ue4.

1 Like

That way, you learn how to do things! Have fun with the engine :slight_smile:

My new query did not appear, so I’ll ask this here. I began working on more features, but have stumbled upon a problem… Variables in the gamestate can’t be modified by any instance other than that of the server. As a solution, I set up a playerstate BP which contains an array which the server is to check, add to the public array, and clear. I got the player array, looped through to check each, and can’t actually access the playerstate variable… What can be done to fix that? (it is showing default info - i.e. ping, score, name, etc. - and not my array at all)

Next to the variable name, there is an eye symbol, hit that and compile, your variable should be visible by other blueprints then.

That was already done…

I created a playerstate BP called PState, but when I look at the playerstate instance of the item from the list, it shows only the information that is in the default playerstate. (the one which is no longer active and not really a BP or doc)

It says “variable is public but MISSING TOOLTIP” … What does that mean?

Solutions, anyone? (I need this to move quickly so I can finish something)

You need to cast it to you specific PlayerState.
Make sure you assign your specific PlayerState Blueprint in your Game Mode so it is automatically created

I did, but now it isn’t reading the correct values, and is getting null when finding the array value… On the client side it is not null.