I have been working on my 'Micro Scan' system for more than a year. It basically moves one or multiple locations with different sizes to every single place on the map. So it can cause certain events to occur. For example, you want to make any marine can take item, if you use movelocation() then you will end up with locations being stuck on one left-most marine.
So here is my method.
Place 192 units on each end side of map. So it consumes 192 X 2 units in total. I will call these units 'Scan Axis'. Now make 192 locations starting from size 1x1 and end up with 192 x 1, have location's width increment by 2. I will call these locations 'Scan Location'.
Since it is hard to explain by paragraph, I will list bunch of steps to show you what happens in my algorithm.
(note: assume that 'Scan Axis' is previously owned by P9, and P9 represents current area has not been scanned, and P10 represents area has been scanned. And scanning direction will be left to right and bottom to top.)
Step 1. If there is any unit on the map then prepare for scan, otherwise wait.
Step 2a. If there is no unit in Section A ((0,0) ~ (0,31)) then give every 'Scan Axis' in this section to P10.
Step 2b. If there is no unit in Section B ((0,32) ~ (0,63)) then give every 'Scan Axis' in this section to P10.
Step 2c. If there is no unit in Section C ((0,64) ~ (0, 95)) then give every 'Scan Aixs' in this section to P10.
And it keeps going like this. The main purpose of doing this is to keep out those areas that do not need to be scanned from wasting time.
Step 3a. Move every ‘‘Scan Location’’s to any 'Scan Axis' at left side of map. If there is any unit in biggest ‘‘Scan Location’’ which has size of 192 X 1 then start scan, otherwise give 'Scan Axis' to P10.
Step 3b. Now look at the center of each 'Scan Location'. They point to coordinates (0, y), (1, y), (2, y), (3, y),...(96,y). This means you can move location to anywhere within the area of (0,y) ~ (96,y). Now move event locations to centers of each ‘Scan Location’. And after center of (96,y) has been reached move every ‘Scan Location’ to any 'Scan Axis' at right side of map. And this time it will be backward. Think of it as mirror.
Keep doing these steps until there are none more 'Scan Axis' has left.
But, there are lots of problems with this algorithm. First of all, since it uses giveUnit() command, it will lag the game. And this algorithm isn't so efficient because it consumes lots of units.
I have tried to make X ‘Scan Location’ and Y ‘Scan Location’, so that the system only needs 4 units, but it had to consume 192 locations. So it's not good either.
So I ask you for help.
Actually, I'm looking for someone who want to complete my project together.