OK bear with me here I got that part - where can I find the "If X found" function? The only similar thing I can find is for pathfinding "On path found"
Its not really a function, why I put it in <> to just show that if it was the case, then what would happen.
<If tree found> is automatically done if its true.
To explain it, imagine this:
3 workers
2 Unoccupied tree
For each Worker <---- Will run 3 times in a row since there are 3 workers.
Tree.Occupied = False <---- Will pick all tree which are not occupied. In this case 2.
Pick Nearest Tree to Worker <--- C2 will check the distance from each tree to the current Worker and select the nearest one.
<If tree found> <--- Since it picked a tree it must be true otherwise it of course couldn't pick any and therefore false.
So when the first two workers have been assigned a tree, there will be no one left for the last worker and therefore it wont be true. In which case you can throw in an else.
<If tree found>
----> Go to tree
<Else>
----> Do something else
[/code:305s3aic]