Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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? alt text

Product Version: Not Selected
spawnmultiple.jpg (109.2 kB)
more ▼

asked Apr 12 '14 at 01:27 PM in Blueprint Scripting

avatar image

966 143 150 390

avatar image Thumper Apr 12 '14 at 02:29 PM

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. alt text

avatar image Alexander Paschall ♦♦ EPIC Apr 12 '14 at 04:20 PM

Hey Thumper,

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!

avatar image Thumper Apr 13 '14 at 01:36 AM

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 :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Apr 12 '14 at 03:30 PM

avatar image

966 143 150 390

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question