I am trying to locate a specific object within a 5 tile radius of my own mob. If it finds multiple of the same, it should only return the closest one.
Is there already a premade function for this purpose? I have tried locate(), but scanning the whole map everytime does not seem like a good idea.
If I wanted to get the distance between the object and the mob, is there a standard function for that?
|
In response to Lelcat
|
|
All objects A in range(Dist, B) satisfy the condition get_dist(A, B) <= Dist.
Here's the relevant chapter in the Guide for both of your questions. I recommend skimming through the entire Guide when you have the time. It's old and no longer complete, but still valid. http://www.byond.com/docs/guide/chap14.html Of course, you can look up every built-in proc (and more) in the Developer Reference built into Dream Maker by pressing F1. |
This should always also give you the closest one.