AI conditional choose between 4 chairs

I am trying to make some kind of simulations with 4 chairs and AI controller driven characters that can make desicion based on 1st nearest chair where I compare the distance between character and actor(chair) with get distance to actor node
and the 2nd condition is something that I cant manage. If chair is busy, I place trigger volume infront of it in a actor blueprint, boolean variable lets call it “busy” gets true. so its being excluded from array of actors(chairs).
this is how I think it can be done. But when i fire ai controller at the second time “busy” gets false again.
I am new in blueprints.
Maybe there is some better way to solve this problem?

what your trying to do is actually quite simple. first lets start with your second condition. you say you want any busy chairs to be excluded from the array of actors but its much easier to just exclude them from the result by using a simple check. to begin you will get a array of all the possible chairs by using something like the get all actors of class node, then you run a loop to determine the best result. in the loop you have conditions that must be met and have a variable which holds the current best result / actor. so for every actor you first test is it busy, if yes you ignore it and move on, if no then you move on to the next check. ok now for your first condition of distance to character. this one is pretty easy too, you just need to compare the distance of the current closest to the actor being tested in the loop, then set the current closest variable based on the result. see below picture for a basic example.

Many people have needed a way to “get nearest/farthest” this or that so I created this node to perform that action internally and output the sorted array (near to far or far to near, you choose) along with the distance to the target actor if you need to use that for any reason. It will be quicker for looping through the array output from “get all actors” since it will be performed in C++. The only thing you will need to add is the boolean check. Below is a screen shot of the node and a link to a tutorial showing you how to create it. Hope this helps.

Thank you all
For checking distance this solutionas are great

Second condition solved my primitive way I could by the time. Created actor blueprint with boxcollisn components that I then placed around each chair and called function get overlapping actors for each component. It has array output. I counted Lentgh and stored that to variable of type Integer. Then I made array of all this variables and used function min of int array
This prefered a free 0 overlapped chair whith with smallest index.