Better AI farming method

Hello, I have this problem that I just started out with unreal engine and my problem is I want a AI character to scan how many gold blocks lay around and then checks which one is not already being farmed by another AI character. When he finds one, then he goes to that location and then start farming it. I guess nothing out of the world for unreal engine, so I googled a bit and decided to go ahead with the method “Behavior Tree” which works fine, but I think my method is not that good… and I encounter some bugs (like if I have more then one AI character). The problem I think is that I use “Get All Actors From Class” but at that time when another gold block is being spawned the Array index numbering will be a different each time some gold block is either spawned or farmed.

This is my current blueprint to Move to the gold block.

This is my blueprint to start farming the Gold block. And here also I have a problem that the “Blueprint Interface” is not being called when the Gold block has a value of 0 or less. So as the workaround just to test (skip this problem at the moment), I set a timer to set the task as completed.

Could you suggest me a better alternative than what I am trying to achieve currently ? And also do you know what the “Blue Print Interface” is not being fired from the gold block side ? Thank you.

I would suggest creating a class that would take on the role of a resource manager. It could track which character is doing what task regarding resources. It would hold an array of characters and their current resource.

Then before assigning a new task to a character you could check the resource manager if the target resource isn’t already assigned to another character for farming.

A bit of a similar situation is tackled in this video