Download

[HELP] Each AI enemiy instance shares the same bool variable ?

Hello
Here are the pics : Imgur: The magic of the Internet

I will try to explain, it’s kinda hard.
So I have a behavior tree which drive my AI_enemy_BP.
The state of the enemy is defined by a VisionCheck task, which change when the AI see me or not (with AI Perception in the AIController). If the AI see me, a variable See is set to true. In VisionCheck, if he lose sight, it is set to false.
But the problem is if one of the enemy in the scene see me and go to Combat mode, then every enemy in the scene will see me and go to Combat mode too…
I don’t understand, it’s like there is only variable See so when the variable is true for one AI instance, it is true for every instance…

Can you help understand this ?

Post a screenshot of where u set the bool in the blueprints.

There is a setting somewhere, it may be in blackboard only, to set the variable to “instance editable”…like what u are talking about…if u set it to true, it can hold different values for each instanced ai sharing the same blackboard or behavior tree…

I think you are talking about ‘Instance Synced’ but it was already untick…

Here is the schedule of the AI: (AI Controller) when AIPerception detects the player, it set blackboard key (called CanSee) as a bool (so it set CanSee to true, right ?) AND I set another-bool variable that has the value of CanSee? call SEE -> (Behavior Tree) in VisionCheck, if the blackboard key CanSee? is true, then the AI enemy is set to combat mode, if false it’s either to Idle or to seek -> In the AnimBP, I cast to AIController to set a bool variable that has the value of SEE. This new variable is the bool that enter transition to Combat animations blendspace.

But still, AI enemies are not independent, while one enemy doesn’t see me for example, the other will not enter in the Combat animations blendspace. But every enemy has saw me, they all enter in the good animation blendspace at the same moment…

What am I doing wrong ?

All of that sounds correct from my knowledge level…I am probably not much help but can you post screenshot of your behavior tree? Did you expand the logic properly using the selector nodes to make sure the a.i. knows what to fully do and so the behavior tree restarts itself? Did you use the “Set Anim Instance Class” blueprint function improperly somewhere?

This is unrelated, but I know using pawn sensing you can deviate the sensing update interval to add behavior variation between all the ai’s.