Need help getting the current players player index

so im making a multiplayer game in ue4 but i can not figure out how to get the current players player index.
idk if it is a get node or needs more coding but thank you for reading.
PS i dont want to get the controller i just need the index its self

if you don’t mean local multiplayer (splitscreen) it is 0 on the clients. If you want to get the controller of a specific actor, you can use “Get Controller” instead of “Get Player Controller”. what’s your setup? For what do you need it? the server only has a array of all playerControllers - if you need a specific one, get it there or with the actor->getController().

so i do have the get controller node but how do i get the index from it
(i need the index for what im doing)

Thank you i will try it

GetPlayerControllerID is the local index of the specific PlayerController. In online Multiplayer you should not use this index but instead use the PlayerState PlayerID.

Player ID changes every time you play a match so it’s not really something you can use in place of a player index which remains static. Apparently what you’re supposed to do - and take this advice with a grain of salt because I’m still figuring this out myself - is when your player joins your lobby or match, you can get an array of the players in a match and store these to a variable to access later. That being said, I’m still not sure how that helps you to identify one player from the other. I suppose the index order of the array…

One thing for certain that doesn’t change is that each player who joins a match gets an instance of your player character and the first player to join will be named Character0, the second will be Character1 and so on. So you can definitively be certain that the display name of player 1 will be “YourCharacterPawn1” and player 2’s display name will be “YourCharacterPawn2” etc. To get the display name, you can use the “GetControlledPawn” node and then from there “GetDisplayName” node and check to see if this is equal to some value then do XYZ based on that. You would have to implement this either in the GameMode or GameState and have the Server do the check otherwise, they’ll both have the same display name.

Obviously, if you’re making a game with dozens of players then this sort of check wouldn’t be feasible, but in my case there’s only two players max so it was the best method I could think of to sort things out (in my case changing the player’s color based on Player 1 or Player 2).

If I can figure out a better way to do this, I’ll come back and update this thread.