Getting Local Player Index

I am building a simple local multiplayer game using Blueprints in which I am trying to identify which player has collided with an object. I want to know if it was player 1 or player 2. I know each player has a unique Player Index value but I cannot figure out how to access it. Any help would be greatly appreciated!

There no stored player index, if you look on source code of those functions (exposed to blueprint) that use player index as input you will see they all use get array of players or iterators and use inputted index to just pick array position.

You need to create your own player ID system if you want, i don’t think it should be difficult with blueprints just assign IDs on adding and removing players of the game

Hello,

After quite a while of experimenting and tampering with nodes, I figiured out a way in which you could easily assign an index to all local players which is equal to the player index.

Hope you can read my messy layout, I tried to fir everything on one screen :stuck_out_tongue:
See, I created a variable called ‘Local ID’ and have made it Editable, so that, using a function called ‘Update Local Player IDs’, I can cast to all players with their corresponding Player Indexes, and then simply assign the equal value to their Local ID. It s best to call this function whenever a local player joins or leaves a game. If you want to be super safe you can simply call it on the tick event. I then linked every ‘Get Player Character’ node to the Local ID, and profit!

Hope this helps!

Any chance you could make a little bit more of a in depth guide on how to do this please? Im pretty much a beginner and having a really hard time trying to set this up xD