Behaviour tree quiqstart guide - new functionality

Hello Guys. I was recently learning about behaviour trees from official quickstart guide https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/index.html

Since everything is working perfect, I would like to add a new functionality to this behaviour tree. Lets say we spawn 3 enemies. I would like to add some behaviour to ai enemy - a variable which every one of them would check during the “AggroCheck”. To imitate some “swarm” behaviour by using only one variable. I made a sketch of what I would like to achieve, it’s on attachment.

I thought to set it up in “AggroCheck” Service. During spotting player a variable, lets call it “roar” would be setting to “true”. In the same AggroCheck, there would be also a node that would be checking if other pawns noticed player. And this is my biggest reflection - how can I make it in this blueprint that the pawn would be checking other pawns around some radius? (to see if they noticed the player).

Well you more or less already came to the right Conclusion on your own. So if you see the Player you change your state to Chasing the player and Check if there are other Enemies around you by say Get Overlapping Actors → foreach → check if overlapped Actor is already in the Chasing State (to avoid infinite loop, ignore those) if not make him do the exact same thing your first Enemy did (you can create a Function for that). Everyone in Range will end up in the Chasing state. Thats about it in a nutshell.

Good Luck and have Fun =)

Hello,
Thank you for tip, it drives me to the correct way of thinking :D.I think im nearly to win this. Last to things left for me. So in point (1) it’s decided wherever enemyCharacter see player or not. If yes, i set “roar” value to true . And a enemyCharacter is receiving both player location and target to follow. If no, I’ve put a loop foreach actor. Now, i don’t know how to set foreach in some radius around. Can you give me another tip? Also in getOverlappingActor, what should i put into blue target socket?

You over Complicated things there a bit. Look at this example logic as a Guide (Im to lazy to setup a BT now sorry, but the logical part stays the same)

I hope to simplified it with your example, however Im missing where to put As enemy character from “cast to enemy character” node. In the end, it has to go to “set blackboard value as object”.

However now im thinking, isn;t this script is running for every enemy character? So in the end, I may set up this for enemies around but right after this script is running for them and they dont see the character so they stand in place.

But that inside your AI Controller https://i.imgur.com/eYv1L8P.png

In your Service you already got your AI Controller ref so drag a wire out and call that function. I looked at the Quickstart service and you should have your Target to follow from the line trace. But watch out if your Agro Check runs again your Target to Follow will unset (out of sight) so you very likely want to set the Target Location inside your AI Controller too (or only the Location, up to you) so your other Enemies run to the Location the Player was Spotted. Also dont forget that your Agro check executes in periods and you might want to avoid Calling OnTargetSpoted every time. You can avoid this by checking if you got a valid TargetToFollow before calling OnTargetSpoted so it will execute only if Line of sight is established.

I think that should cover all things now xD (I hope)

And last addition if you want to keep everything in your agro check you can get the others Enemies Blackboards like that ( I prefer Controller ) https://i.imgur.com/oVG8gmN.png

Now i think i overdid it muuuuuuch.

Round start, enemy are spawning. Im running and get of their sight. They will go to my last known position and after wait time (2.5s) every one of them will go to their home location. Its kinda long cause each of them will go himself after 2.5s after previous one. Then after reaching home location, they will roam from home location to my last known position.

Quite different is when there are already enemies on the level when load. They will go after me, after lost track they will just return to home location. And wont move from there until i will come closer again

Maybe I should really put everything into AgroCheck. But I didnt underseand you picture from AgroCheck.If I noticed enemy, i put it as “YES” node from most right Branch?
Im attaching my AggroCheck, EnemyAI, spawne and FollowerBehaviourTree.

Im also receiving an error when spawner is in the game. Problem gone when i delete spawner