How to make spawned character chase player?

Hello. I’m trying to make npc which can chase player. I created npc blueprint with perception and when I’m just drag it to scene it chase the player without problems:


But when I’m trying to spawn it in other bp with this script:

the NPC just standing in one place. I’ve tried to debut it and the only thing I know there is no controller in this bp:
image
Why is it happening?

1 Like

Hello!

So I’ve never, personally, used the SPAWN_NPC function.

Just to make sure that it is firing correctly, attach a PRINT_STRING node to “Is_Not_Valid”.

If the string does NOT print, then attach it to the SPAWN_ACTOR output pin.

Come back with your findings.

Just checked it - the variable is valid.
The string isn’t firing after spawn actor too. Strange…

Just to be VERY CLEAR, the “Is_Not_Valid” PRINT_STRING attachment did NOT fire, yes? Nothing appeared on-screen?

Yes.

Just like in the other thread, the other day, this seems to be the clue:

image

By default, characters are only possessed by an AI Controller when Placed in World:

Adjust it to one of the highlighted options since you’re spawning them dynamically. Alternatively, you can do this in the NPC instead:

image

You will also need a navmesh for the AI to run around on, ofc. Once the above is set up:

:crossed_fingers:

2 Likes

Yes, now it fixed. Thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.