im working with behaviour tree and i have made a ‘attack’ task that should attack when it sees the player, but the thing is, i need to have 3 ai’s attacking when it sees player, problem is, it attacks the other ai’s and player and i want the ai’s to only attack player when it is seen.
So what I would do is use a “Player” and “Enemy” tag on all of the characters but… I can’t really help tell you if that would work here because all this is a picture of is an anim montage…
Wherever your sensing system is, if you show us that we can help you!
But basically, give them actor tags, use “ActorHasTag”, and plug that bool into a branch
Close! What I meant specifically however is how the AIs are gathering information about the environment, which in this case is AIPerception!
So you’ll open up your player first, as long as the enemies and the player don’t use the exact same bluprint this will work.
Click the root of your character in the components window, and then in the details window for the root you want to search “Tag”. Add an Actor Tag of Player (Make sure to not leave a space). Compile your player BP, close it.
Now we go back to your AI controller. Off of “On Target Perception Updated (AIPerception)”, take that actor pin and use “Actor has Tag”. Put your player tag in, make sure it is spelled the EXACT same, and it is case sensitive and space sensitive as well.
Plug that into a branch before the branch you already have, run through on true, do nothing on false and you’re good!
Do they all use the same blueprint, but with different controllers?
If you’re saying they’re all Children of “Character” that’s ok. As long as the player isn’t the child of the enemy, or the other way round, or they’re the exact same blueprint with different controllers.
But if they ARE the exact same with different controllers, you can use “AddGameplayTag” on Begin Play on the PlayerController, using the possessed pawn as the target.
You have it set up exactly the way it’s supposed to be minus one thing! Component tags are different from actor tags. You need to tag the root to make it an “Actor Tag”. Like this