Download

What is the player index to use that includes all players?

I’m trying to get an actor to be able to recieve keyboard inputs from all players. I’ve made it be able to recieve inputs from a specific player, but I want it to include every player. (I can’t get a picture to work) So what do I do to the ‘get player controller’ part that currently says ‘player index:0’ to make it include all players?

P.S I started using UE4 yesterday so go easy on me.

Simple: use get player controller for every number up to the number of players you have, store those in an array, take logic based on that array of players accordingly
more complex: the actor in question has an array that represents inputs. All players can call functions on this single actor which adds inputs into that array. The actor simply does things one by one as long as that array has inputs in it. inputs will be executed in the order they are received.

without more detail those are the two solutions you’ll want to explore

What if I don’t know how many players I have, and it changes every time and throughout the game?

then that is another number you need to keep track of. As far as information goes, knowing how many people are in your game at any given time is pretty pivotal

An important question here:

Are you talking about local, one PC, one Game, Gameplay, or are you talking about actual Internet/LAN Multiplayer?

Because for local Gameplay, you actually create multiple PlayerControllers by hand and then you can access them via theese indeces.
If you are actually referring to Internet/LAN Multiplayer (so multiple PCs), then it’s something totally different
and I don’t really know if that’s something for “I started yesterday.”

I normally only recommend learning the Networking side of UE4 once you have a few weeks/months worth of knowledge of UE4’s
Gameframework for Singleplayer.

OK then, I’m talking about locally on a single computer I suppose.

Thanks for the help everyone.

You could just do a “get all actors of class” which does return all available player controllers.