Hot to Spawn multiple AI characters when using Behavior tree

I’m able to spawn a character class and get Behavior Tree running fine. The image below is where I’m doing this in the level BP. It appears that if I add in a loop in this level BP and attempt to spawn more than one the cast to AI control fails. Am I supposed to do the last steps multiple times? Like, Spawn Defualt controller, Cast to AI control, and Behavior Tree only need to run once?

So I guess my question is - Do character class copies use the same AI controller referenced in their defaults? Also, does behavior tree run once and then manage the group? or would there be multiple behavior trees running?

So here I’ve tried to create some arrays to hold the looped spawn of the character class and also the EnemyAIControl class. I’m trying to make sense of what I’m seeing. Wouldn’t my loop on the right finish first and then print out stuff first and there by be listed on the bottom of the in game shot? Then my outter loop on the left would finish second and the print’s would be listed at the top of the in game shot? At this stage it’s very finicky. Definitely some game breaking loop failures by linking the wrong things together. Currently my character will spawn, But it appears there is only one, that run around, unless the other 4 are perfectly spawned on top / inside the one that is visible. Any thoughts on how I would go about spawning these five characters around one another and how to handle the casting to AI control/ running behavior tree when you have a pack of AI characters like this would be greatly appreciated.

Bah, The problem appears to be that my random location in radius was causing the Cast to Ai Control to fail sometimes. So instead I broke out the vector and only randomized the X/ Y axis and did away with all the arrays. I was clearly over thinking it. Now it just does a loop while the number of spawns is less than whatever.

Hey

I am looking into this and have a few questions. Do the UnitSD spawn in and then casting fails? Could you please check on the “Spawn Even if Colliding” to see if that changes anything? Does the first one spawned behave as expected?

Thank you!

So far they are behaving as expected. I’m getting further into this stuff now so maybe soon I’ll know more. The problem is that I was doing it wrong. What was happening is I was trying to spawn them at ground level, and I believe that the class was/ would have been lodged in the ground and so an error occurred. What I do now is simply have them spawn higher up and I got rid of all the array stuff. I just use a while loop to spawn the entire branch after the Event X number of times. So it Spawn’s AI, spawn’s default controller, get’s controller, and then Cast’s to the AI controller that I’m using and finally runs Behavior Tree. It does this X number of times in for the “while loop”. Every duplicate drops to the earth and runs/ performs it’s bahavior tree routines. No problems at this point (for now :slight_smile: