One blueprint for multiple AI

Hello everyone. I tried to explain the thing I struggle at the picture a posted. I know I had to do something with Parent/Child classes and array structures but i really can’t figure out how am i going to do that. I really need your help. Thanks to all of you <3

i think im reading this right, you want when the enemy is behind something for them to move toward the player right? and your plan for this was to use a line trace to determine if the player can see them. if thats all true then you want something like the below example. in the example you first get a list of all the enemies, i did this via a get all actors of class but you will want to make this a variable array if you plan to call it often. then for each enemy in the array i used a line trace to determine if there was anything between them and the player. if there was something between them aka a hit then the return value will be true and we call the start event in the specific enemy we were testing.

you could also do this in the enemy instead which would avoid the need for an array.

Thanks for answer. That’s exactly what i wanted to do but i already did it. The problem is, when i add more than 1 BP Enemy to level, when one of them behind the wall, all of them starts to move to player not only the one which is behind the wall. I solved it by making different BP for each enemy but it really kills the performance. What should be the rule in the BP_Enemy blueprint for making the only one Enemy move towards to player even if i duplicate the same blueprint for creating multiple enemies in my level.

if you did it the way that i showed then you would be calling the movement event aka the start event on only one enemy. so it isnt possible that it would effect them all.

also what do you mean you created a bp for each enemy? are you saying that you made each enemy its own actor class? thats just bad on so many levels. all you need is one class for an enemy (if they are to be the same type), then you use the script to affect only the instance that you want. this is why i used the for each loop in my example. the for each loop gets each individual instance (enemy placed in the level) and runs the script for only that one enemy, then it repeats the process for all the others. so to summarize the above script its like the character asking ok enemy one can i see you, no then im telling you to start moving, yes then do nothing. ok we are done with enemy one now ask enemy two can i see you… etc etc for each enemy.