I have a problem enabling input for my main character.
I have two characters, the player’s main character (ThirdPersonCharacter) and another character (an NPC).
Enable input works normally for the main character when overlap events are generated from other objects, but as soon as an overlap event is generated from the NPC, input is not enabled for the main character. The Enable Input node gets executed correctly.
The specific overlap event and ‘Enable Input’ node are located in the NPC’s Blueprint, and at first I thought that I had to connect the “Target” input pin of said node with the character’s Controller, but that didn’t work either.
To sum up: There are two characters, ‘Enable input’ in the BP of one of them doesn’t enable input on the other one. Note that I did connect the ‘Target’ input pin to the corresponding player’s controller.
If you want another actor to receive inputs, it needs to be possessed by a PlayerController. If you want to control one actor at a time, then you can use Get Player Controller(0) - Possess (The actor). But if you want to control two actors at the same time, you have to make a 2nd Player Controller, and possess it with that.
But this question has been asked multiple times already in different ways.
Thanks for the answer.
Sorry, but I don’t think this works. I know it has been answered multiple times, but I have a feeling that I don’t understand something in the process.
I don’t want to control any other actor; I just want to enable input on my character (which is already possessed with a controller), when an overlap event is generated with another actor- and I want to do this from that actor’s (NPC) blueprint.
Here is the blueprint that is supposed to work (NPC’s BP- doesn’t work):
And here is what I wanted to do and doesn’t work either:
Any further help would be appreciated!
Aha! Then this whole thing should be at your player’s blueprints especially the E input one. Because this way it still would mean that the actor should know about the inputs of the player, which still requires a player controller. So put the E - Print string in the player controller blueprint at least. By the way, disable /enable input is probably not the best way to do this, because it disables every input for the game. Even Esc for the menu and such.
I see! Thanks, I will try it out and let you know how it works.
Also, what do you suggest as a best practice instead of enabling/disabling input? Because I’d like some key events (ESC, etc.) to be enabled at all times, and other events (e.g. E, F, etc.) to be enabled some times only.
I’d use a bool variable, and after every input node, I’d put a branch with it (except for buttons like Esc)
Thanks a lot!
The solution you proposed above worked like a charm.
But I’m not quite sure what the problem is; Is it that characters and pawns cannot send input commands to other characters/pawns? And if yes, then why?
The only object that can see the the player’s inputs is the player controller. This should represent the will of the player. It is the rat from the movie Ratatouille. Only those pawns know what the rat want, whom has it in their hat. But the rat can still “talk” to the other actors with events, if the controller gets somehow its reference, or something. Is it clear this way?