For most of the day, I've been killing myself trying to figure out how to measure the shortest distance between two objects and then moving one of the objects to the other. For example, a man gets hungry. There are several break rooms in his workplace and Construct can't really decide which he should move to, so it ends up picking the one so far away that he starves to death on the way.

Almost worked, but if I have several instances of scientists that suddenly get hungry at the same time they all pick the same table. Still, better than nothing. I suppose it'd work pretty well as long as not all the scientists are created at the same time.

Thanks!

Edit:

Actually nevermind, seems it only finds the closest table to the first scientist to spawn.Murkat2011-12-18 10:50:42

Woo, fixed it with a For Each loop. I'm a bit concerned that this might slow the game down in the future, but testing it with somewhere between 50-100 instances seemed to work pretty well, and I doubt I'll need more than that.

Man that felt good.

Edit:

@SoldjahBoy Not quite sure what you mean, but doing it like this seemed to fix the problem.

If there's a better way of doing it(I literally just found out how sub-events work today), I'd very much appreciate the input. I can already tell this method of doing it is less than optimal, but it's the only one that worked, so yeah.Murkat2011-12-18 17:49:39