I've not seen anything on the forums or wiki that provides quite this functionality, so I thought I'd share it. I've created a system that will determine the distance between two units' x and y coordinates. It utilizes location shifting to ignore one coordinate at a time. In my sample map you can see this happening along the top and left edges of the map. Your zergling and marine's movements are tracked by burrowed zerglings. Then it's a simple pseudo-grid (It can't place a location at a specified destination, only detect units) to compare the distance between the x-zerglings and the y-zerglings. The advantage is that this pseudo-grid utilizes 30 locations, but can cover most of the map!
The sample map can determine the distance between x and y coordinates up to 224 pixels (7 tiles) with an accuracy of 8 pixels, rounded down. A pixel accurate version could be created using more locations. I've used zerglings, which are 16x16 pixels, so to detect distances smaller than 8 pixels I would need to use inverted locations. I believe a hybrid with a static grid along the axes could be used to increase the maximum distance detectable to the map size, at the cost of units.
I used the trigger generator LIT, so I'm including the lua file and a link to CecilSunkure's thread for LIT.
RelativeDistance.scx
Attachments:
Post has been edited 2 time(s), last time on Jan 3 2019, 4:04 am by goobie.
There's got to be something more to life than being really, really, ridiculously good looking...