Get Player Controller ID returns -1 ?!

Hello, I have a wired issue where when I get the player controller ID of the possessed character, it returns -1. Even tho its set to auto possess as player 0.
Can anyone explain whats going on?
Heres an image of the eventBeginPlay blueprint that does reads it.

https://dl.dropboxusercontent.com/u/25584030/ue4PlayerIDFail.PNG

Shouldnt it return 0? I can remember it was working for me previously, but now it returns -1 and im stuck.

Ok, Raildex from discord gave me the important help. I need to plug in a player to get player controller ID. Now since this happens on the characterBP and I have several of those in the world (as im also using the same blueprint for npcs atm) I thought there was a way to have the blueprint know which ID its been possessed at (in my single player game that would always be 0) so I can know which of the characters is posessed and load the player settings to that instance only.

But it turns out, its not a wise thing to do that based on hardcoded playerIndex so Ill instead use the event Possessed to load the player stats to only the posessed character. I might need to add a few extra things, so that it only does it to the first character you possess starting the game, not any other that a you might possess later during gameplay.

Quick question here then: whats the order of the events execute when I start the game posessing a character, does it first execute begin play and then event possessed? (would make sense)

First things first:
What exactly do you want to do?

There’s probably a much better and easier solution.

Thanks for replying here too mate. Alright, heres what I want to do:

I have made a characterBlueprint that holds my main character, but that same blueprint also has ability to become an npc (which uses the same skeleton).
So I place it 2 times in the scene, one for the player character and one for the npc (which only has to stand around in idle).

I have set the auto possess player on the one I want to possess when starting to play to player 0, the other one is disabled.
https://dl.dropboxusercontent.com/u/25584030/ue4PlayerBPInfo.PNG

In the blueprint I setup the event begin play like this: https://dl.dropboxusercontent.com/u/25584030/ue4CharacterBPBeginPlayFunction.PNG
The result when starting the game is this: https://dl.dropboxusercontent.com/u/25584030/ue4PlayerBPExpectedPrintBeginPlay.PNG
Which is to be expected as both blueprints run through the event begin play.

Now I dont want both blueprints to execute a certain function (here just a print). But ONLY the one the player starts with. So I thought event possessed works out here.
So I setup the event posesssed function like this: https://dl.dropboxusercontent.com/u/25584030/ue4CharacterBPPosessedFunction.PNG
But the engine prints out this when the game starts? https://dl.dropboxusercontent.com/u/25584030/ue4PlayerBPNotExpectedPrintPossess.PNG

What the f. is going on there? I know that the other blueprint (maya_characterBP2) gets posessed by the AI as per Auto Posess AI = Placed in World so it prints one. I have tried disabling that and as a result that doesnt print anything.
But Why exactly is my player print twice? Even if I set the Auto Possess AI to disabled, it STILL prints itself twice, it has to be executing event possessed twice, but why?

And what If I want to execute a function ONLY on player possess, not on AI possess? How to tell the blueprint it is the one owned by the player so only it does something and none of the other copies of it that may be in the world.

I recommend using interfaces for this and delegating the functions from the Player-/AI-Controller to the Pawn.

To solve your problem, OnPosses, you get a Controller Reference. Cast it to PlayerController and do your Player Stuff.
If the Cast Fails, Cast to AIController and do your AI stuff.

Thats some useful info mate, Ill check that out! Stuff is working now - somewhat. Thanks :slight_smile:

Just a little thing is that event possess triggers twice on my one playerBP