Download

Getting Player Controller ID

If two players are using the same character/blueprint for their controlled pawn, then how do you set the Get Player Controller nodes inside that one blueprint?

For example, in my Character Blueprint I have an ‘Is Input Key Down’ the target of which is a player controller. The player controller needs to be 0 for player 1 and 1 for player two. How can I achieve this short of duplicating the blueprint for player 2 and changing this every time?

I think there are a few work arounds for this but I would suggest setting a cast reference for each player controller when the pawn is spawned so you can always reference that specific controller instead of the general 'Get Player Controller."

When you spawn the character you could set the PlayerControllerID in the Character and then the Character will always know who is controlling it.
In GameMode override the function SpawnDefaultPawnFor and add “call to parent function” after the parent function you cast to your character BP and set the ID using the “new player” (cast this to a PlayerController)

Thank you for the responses! I got it working by promoting the Player Controller to a variable during the spawning event in the GameMode and casting that variable to my character on Event Possessed :slight_smile: