how to get reference of "in-game spawned pawn"?

I have a main character in my game. then i spawn another character “character2” while playing game using “SpawnActor Character2” node.
i want this new character2 to do some AI work. i figured how to make him follow target points via “level blueprint”. but it is only working if i manually put that character2 in scene before starting the game.

But what i want is… start my game > spawn character2 > then let him do his AI work.

But how can i get a reference of newly spawned character in my “Level Blueprint”??
and if it is possible… to get dynamic reference of spawned pawn. will it work if i spawn more of them. assuming they all are doing same work??

on the other hand if its possible to program it on its own blueprint (character2BP)? is there any easy way… similar to level blueprint??

Why there is no answer so far :expressionless:

If you have some Character specific behavior, you should put it in it’s own blueprint

If you open your “character2BP”, try to put the same logic in there than the one you had in your level blueprint.

That way whenever you spawn a new one, it’ll execute its own logic and you will be able to spawn as many as you would like.

to open his blueprint, just double click it in the content browser , if it’s a data only BP you’ll have a message on top saying “NOTE : This is a data only blueprint, so only the defaults values are shown. It does not have any script or variables. If you want to add some, “Open Full Blueprint Editor””

Just click that and you’ll have access to your even graph where you should put all the logic.

Hope this helps,

Cheers

  • Marc

its okay i’m learning AI behavior tree stuff now… its not that hard as i though…
I’m going to create AI character using that… not using “level Blueprint” anymore :slight_smile:

remove the question from forum if needed…!!

Glad you found your way

Here’s a nice tutorial on AI behavior that covers a lot of stuff at a nice pace, very informative : Unreal Engine AI Tutorial #1 - AI Guard Part One - YouTube

If you don’t need any more assistance with this question I’d suggest you mark it as answered for better tracking

If there’s anything else I can assist you with just need to ask or create a brand new question if it’s not related anymore

Cheers

  • Marc

thats exactly what i’m watching… thanks for putting it here it will help others too :slight_smile: