Every square is a region and regions have corners, they have 4 of them (duh).

I (or my trigger) is determines how many squares over the X and Y axis must be placed before it you get to the target location, then it stops.

These triggers dont use WC3 world editor regions

ADU (acronym) = Azerothian Distance Units (one human farm is 128 ADU wide and high)

Gameplayconstantsreals 2 and 3 are the dimensions of one square (128 azerothian distance units)

constantreals 4 and 5 is the location of the bottom left corner (-9216,-9216 ADU)

constantintegers 3 and 4 are the maximum amount of squares over the X and Y axis, 88 and 88.

i can altar these constants at any time and warp my scenario's reality as i wish (as long as it fits within 128*88 ADU in both dimensions)

square controller movement

Events

Unit - A unit Is issued an order targeting a point __<--X and Y location of the targettet square will be used to generate the squares its number__

Conditions

(Unit-type of (Ordered unit)) Equal to Controller

(Mana of (Ordered unit)) Equal to 10.00

(AreaTheField <gen> contains (Target point of issued order)) Equal to True

Actions

-------- this first action determines which squares number is gonna be revealed and which square its numbers are gonna be used --------

Set TempUnit[4] = (Random unit from (Units owned by (Owner of (Ordered unit)) of type Controller)) __<-- this function doesnt have a function at the moment__

-------- Tempreal 4 is going to be the X coordinate of the target square --------

Set TempReal[4] = (X of (Target point of issued order)) __<-- setting the X location of the target square__

Set TempReal[4] = (TempReal[4] - GamePlayConstantsReals[4]) __<--Making sure that you got 0 or above square numbers instead of numbers inbetween -4094 and +4094__

Set TempReal[4] = (TempReal[4] / GamePlayConstantsReals[2])__<-- dividing the X location by the width of the square in ADU__

Set TempReal[4] = (Abs(TempReal[4]))__<-- making it an integer__

Set TempReal[4] = (Real((Integer(TempReal[4]))))

-------- tempreal 5 is going to be the Y location of the target square --------

Set TempReal[5] = (Y of (Target point of issued order))__<--Same as X but this time the Y instead of the X from it__

Set TempReal[5] = (TempReal[5] - GamePlayConstantsReals[5])__<--Same as X__

Set TempReal[5] = (TempReal[5] / GamePlayConstantsReals[3])__<--same as X__

Set TempReal[5] = (Real((Integer(TempReal[5]))))__<--same as X__

-------- and now tempreal[5] is being multiplied by the amount of squares that will be placed over the X (horizontal) axis --------

Set TempReal[5] = (TempReal[5] x (Real(GamePlayConstantsIntegers[4])))__<--Here Y is multiplied by the maximum amount of squares over the X axis see comment 2 lines below this__

Set TempReal[6] = (TempReal[5] + TempReal[4])__<--Here Tempreal[6] is assigned the number of the targettet square__

-------- __the Y location is multiplied by the max amount of X squares over the X axis so that if you move up one over the Y axis you can still retain a unique location X that can be extracted from the one location number__ --------

Unit - Set the custom value of (Ordered unit) to (Integer(TempReal[6]))

Set TempReal[7] = TempReal[6] __<-- tempreal[7] is the universal standard value that i use whenever i want to convert a squares number into a location - if you set this real to a number and run the trigger below it will give X and Y locations in the form of TempReal[1,2]__

Trigger - Run Convert Number to Square <gen> (ignoring conditions)__<--Converting the newfound number into the center of the targettet square__

Game - Display to (All players) the text: (Custom Value: + (String((Custom value of (Ordered unit)))))__Displaying the Square number__

Set TempReal[1] = (TempReal[1] + (GamePlayConstantsReals[2] / 2.00))__<-- adding half the width of a square to the location to get to the squares center__

Set TempReal[2] = (TempReal[2] + (GamePlayConstantsReals[3] / 2.00))__<-- adding half the width of a square to the location to get to the squares center__

Unit - Move (Ordered unit) instantly to (Point(TempReal[1], TempReal[2]))

And now converting the X+(Y*MaxXsquares) number into a square location (back to where you started, but this time on the bottom left corner)

Convert Number to Square

Events

Conditions

Actions

Set TempReal[1] = TempReal[7] __<-- Tempreal[7] is a holy standard inside the trigger, it is not altered and is a referance__

Cinematic - Clear the screen of text messages for (All players)

Game - Display to (All players) the text: (XY: + (String((Integer(TempReal[1])))))__Ingame check, used to make sure its using the right number - will be removed in final version__

For each (Integer A) from 1 to GamePlayConstantsIntegers[3], do (Actions)

**Loop** - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

TempReal[1] Greater than or equal to ((Real(GamePlayConstantsIntegers[3])) - 0.00)

**Then** - Actions

-------- __this repeating function substracts the <Maxamount of X squares over the X axis> untill the Y location is factored out of the X calculation__ --------

**Set TempReal[1]** = (TempReal[1] - (Real(GamePlayConstantsIntegers[3]))) __<-- beware, this is part of the loop function__

Else - Actions

Set TempReal[1] = (Real((Integer(TempReal[1])))) __<-- by converting the a real into an integer and into a real again you destroy everything behind the comma, 8,74217 -> 8,00000__

Set TempReal[1] = (TempReal[1] x GamePlayConstantsReals[2])__Multiplying the amount of X squares by the width of a square (in ADU)__

Set TempReal[1] = (TempReal[1] + GamePlayConstantsReals[4]) __<-- by adding this constant to it you let it calculate the distance from the bottom left corner instead of the middle of the map__

-------- now the X location has been determined in azerothian distance units --------

Set TempReal[2] = TempReal[7]

Set TempReal[2] = (TempReal[2] / (Real(GamePlayConstantsIntegers[4]))) __<-- undo what the 1rst trigger did, divide the Y location by which it was multiplied__

Set TempReal[2] = (Real((Integer(TempReal[2]))))__<-- removing the effect of the X location by the same principle as the X location trigger__

Set TempReal[2] = (TempReal[2] x GamePlayConstantsReals[3])__Multiplying the amount of X squares by the width of a square (in ADU)__

Set TempReal[2] = (TempReal[2] + GamePlayConstantsReals[5])__<-- by adding this constant to it you let it calculate the distance from the bottom left corner instead of the middle of the map__

-------- now the Y location has been determined in azerothian distance units --------

i realize that the triggering might be hard to understand with my underlined comments all over it.

i couldnt format it really well because the code tag doesnt allow underlines and the quotes dont allow formatting.

the above 2 triggers work perfectly and i have moved on to other aspects of the game. This is the entire reason i made this post because one of these aspects is the math for infinitely upgradeable research topics and i dont have an remotest or faintest idea how to aproach such a prospect.