Pick the Nearest Object: Using it wrong? [Solved]

Greetings Devs

I hope all is well

I am pulling my hair out here and trying to get this right. I am not that all new to the Engine however for the life of me. I can’t seem to figure this out

In game there will mining drones and each one will collect a space rock however what I am struggling with is the following. I am not sure if I can put this in words

Lets say there is more than one drone in an instance and a couple of space rocks, each drone should go an collect said rock which is nearest to it and return it to station however I can only get one drone to collect said rock. The other drone just sits there instead of going to collect the other rock.

(When rocks equal zero then they should return to station for example)

Any assistance will be appreciated and hope the screenshot of the code I have is enough for assistance as well. Thank you in advance

I don’t know if you want 1 drone per ore. As is, it’s not “filtering” the drones that are picking or the the ore that is being picked.

I’m going to skip steps

If drone isn’t picking
–For each drone
----If ore is not being picked
----Pick nearest ore
------Mark ore as being picked
------Mark drone as picking
------Move drone to ore

In the cented, there’s an inverted owner of ore = “”. Is that correct? It’s basically saying if the owner is not empty or nothing.

As is, the center for each ore is only going to have a maximum of 1 ore because of the pervious pick nearest ore will only pick 1.

1 Like

Hi @Keith_1357

As always you are a Dev God, thanks for the help again. Working now as intended

And yeah its one Ore per Drone as I have var set for each spawned “minin” rock to randomize some basic minerals once the main Mining Frigate or Player has blown up enough rock into the usable pieces.

Rough idea of you help below and how it looks.
Thanks again @Keith_1357


1 Like