0
\$\begingroup\$

I created a project based on the Top Down Example.

In the project comes a character that I can move by clicking on the terrain that already comes by default.

Image of gameplay:

enter image description here

In the character's blueprint, I added a function on the N KEY. Simply to print a sentence (key N).

Character's blueprint:

enter image description here

I created an NPC based on creating a Blueprint Class > Character:

enter image description here

In the NPC blueprint I added a function, only now in the M KEY, but with the same principle. Print a sentence (key M).

NPC's Blueprint:

enter image description here

It turns out that only the command made in the blueprint of the character works:

enter image description here

I alternately clicked the N and M keys to take the screenshot.

I scanned the character's blueprint to see if something was missing, something I needed to add in order for the NPC blueprint to recognize the keyboard command. But I only found things like that related to the mouse.

Scan:

enter image description here

I'd like to know what I need to do to make the NPC blueprint recognize the M KEY.

\$\endgroup\$
11
  • \$\begingroup\$ You have to enable input, at the right panel in search box type “input” it will navigate you to the input tab and you will see the option to enable input. \$\endgroup\$ Commented May 23, 2019 at 22:16
  • \$\begingroup\$ @ColdSteel In this tab appeared 3 options: Block Input, Auto Receive Input and Input Priority. None of them seem to be the option you mentioned. \$\endgroup\$ Commented May 23, 2019 at 22:36
  • \$\begingroup\$ The option I mentioned is obviously the AUTORECIEVEINPUT \$\endgroup\$ Commented May 23, 2019 at 22:55
  • \$\begingroup\$ CharacterBP of the top down template already has it on by default - thats why N did work but M didnt \$\endgroup\$ Commented May 23, 2019 at 22:58
  • \$\begingroup\$ I made the comment because I compared the input tab of the NPC with that of the character and both were the same. And in the receive option, the box next to it appears disabled, but if I click, it displays numerous player options (player 0 through player 7), and does not activate. \$\endgroup\$ Commented May 23, 2019 at 23:03

2 Answers 2

1
\$\begingroup\$

In the Pawn section of your AI Character, you will find the option "AI Controller Class"

AI Controller Class

You need to create this controller class in Blueprint. It's not one of the standard options, you'll need to search for it or use the drop down arrows.

AIController AI Controller image

When you've got this and set up your required options in the Pawn section of your AI Character, you can set the relevant code inside this AI Controller Blueprint.

\$\endgroup\$
1
  • \$\begingroup\$ I created the class. I put the code inside and then set it in the blueprint of the minion. It did not work out here. \$\endgroup\$ Commented Jun 18, 2019 at 21:59
1
\$\begingroup\$

To receive input, you should use a PlayerController. You'd want to check "Auto Possess Player" in your pawn and set your GameMode to use your PlayerController as the default.

However, I'd suspect your new Character receives input and the existing one does not because the new one either has "Auto Possess Player" or is otherwise being possessed by the player and the existing one is not.

In Unreal, a Controller "possesses" a Pawn so it's the thing that can tell it how to behave. So a PlayerController can possess a Pawn and send it commands based on player inputs or an AIController can possess a Pawn and send it commands based on your AI scripting. You can probably use input commands from the Pawn if it's possessed by the PlayerController.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .