Download

Possess works with AIController but not on PC?

Hi there. I’m having a little problem possessing a pawn.
I’m trying to create an NPC that you can talk to, and it should change your camera and run a specific behaviour. So, I thought that possessing it and working out the logic inside the NPC itself, including the possible button presses.
However, when my NPC (Pawn) has its PlayerController set to an actual PlayerController it doesn’t seem to work and when I set my PlayerController to an AIController it works perfectly, but from an AIController I can’t use nodes for key bindings.
What should I do about this?

Here’s how I am possessing my NPC (Norty) from MyCharacter:
00b81461067e9e83c3e95987bf7e34da529134f3.jpeg

Posession seems correct. Is your Norty actor input enabled?

Does it need to be enabled?

input.jpg

I have these settings in both my npc pawn and ai/pc controllers. I don’t think it should affect how they work. I tried adding Event Tick->Print “Hello” in my AiController just to check if it actually does something, but nothing appears on screen, so I’m assuming that the AIController is disabled somehow?

im having the exact same issue
trying to posses a pawn in the same way, it is never possessed by the player controller.
i have aicontroller set to none

I think that what is the case is that something else consumes the input before your pawn or controller receives it. Check out this page for the order in which objects are given the chance to use input: https://docs.unrealengine.com/latest/INT/Gameplay/Input/index.html

You want your playercontroller to capture it right? Or the pawn? The page also mentions you can make any actor highest priority by re-enabling accepts input. Not sure what the bp node for that is but maybe you can find it. Hope this helps!

@Keytotruth
is your pawn actually being possessed? is it a Pawn or a character?

I want my main character to fully possess the NPC I created so I can work the NPC logic inside its player controller instead of the character I’m actually controlling. Thus, it would make it easier to handle if I don’t have to add more code inside my character so I can execute actions such as displaying the next text or choosing an option.

I don’t see anything on how to increase the input priority of anything in the project settings or in the default section or my pawn/aicontroller/player controller. I don’t know what I should do.

I have a Character which is the main player and then I possess a Pawn with an AIController. Doing this, it works, but it won’t accept any input I give it. If I change my Pawn’s controller to a Player Controller, it just doesn’t do anything, so I’m assuming it’s not possessing it at all.

for me it definitely is not possessing a pawn.
it will if i set the pawn as default in the game mode, it will not possess the pawn using the blueprint possess node.

i put an event possessed node to a print string to test it.

what build are you using, mine is 4.6

I’m using 4.6, and I’m also using the Possess node. I just don’t know why this won’t work. It should be simple.

The reason I mentioned the input priority list is not to change it, but so that you can check whether anything with higher priority is already listening for the same input you are trying to catch. But do I understand correctly that you are trying to catch input on the PlayerController, and then use that to test functions on an NPC character that is possessed by the PlayerController? If so, which if the two steps goes wrong? Catching the input (test it with printing) or calling the NPC functions?

Or do you want the NPC character itself to catch the input? If thats the case, calling Enable Input (the BP node) with the NPC character as target should give it highest priority until you disable or another actor calls Enable Input.

By the way, are you sure you’re not trying to possess multiple pawns/characters at the same time? A controller can only possess one.

Basically what I’m trying to do is to actually swap the controller and pawn you are in control of, so you can have isolated key bindings for the behaviour of that NPC I’m creating. Also, Enable Input only works with a Player Controller and when I give a Player Controller to my Pawn, the Possess node doesn’t seem to do anything.

I just tested things in a blank project and can confirm at least that you don’t need to call Enable Input. Its a way to give certain actors higher priority, but not in the way I expected so I’ll just consider the posession method from now.

So the NPC actor itself is listening for key input, correct? In a blank project I created a blueprint MyNPC inheriting from Character and didn’t change any defaults. I possess an instance of MyNPC after play has begun (and its not the default Pawn class). After possession, it receives the inputs (keys, action mappings) without problems. Here is the event graph for MyNPC, so possession exactly like you do:
input1.png

I’m not sure why it doesn’t work for you. The only things I can think of right now, and sorry if I’m repeating anything too much:

  • Your PlayerController blueprint is listening for the same input*
  • Maybe you’re listening for a key that is actually reserved by the editor, such as the F1-F12 keys?

*For example, if I create a custom PlayerController blueprint and add this:
input1.png
then the input never reaches MyNPC, because it is lower in the priority list.

So I hope this simple example is at least helpful as a reference for what isn’t causing the issue.

did you try with a pawn?

a character is not an option for me as im creating vehicles, there would be too many to useless things.

Hi, I just did with same results.

wonder if its because you are using begin play
does it work doing it during the game, having a different pawn at the start?

I also tested with having a different pawn at start, and calling Possess after a 5 second delay. The input still works. tegleg, maybe you can give some more info about your BP setup?

its this https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/PossessPawns/Blueprints/index.html#entering/exitingavehicle
but a pawn blueprint instead of a vehicle

edit:
never mind it was something silly on my part lol
@Keytotruth, check everything 50 times, it does work

Okay, I finally got it working… It does work, but I have to set the NPC’s Player controller as NONE or otherwise it won’t work and I have to handle the behaviour from the actual NPC BP instead of its player controller for it to work.
Anyways, thanks for all the patience you guys have had. I’m really glad I got this working. I was stuck in this for like days.

Congrats both, nice that it eventually works. :smiley: