Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Question on using location grid
Question on using location grid
May 15 2014, 11:03 pm
By: trgk  

May 15 2014, 11:03 pm trgk Post #1



Please explain the map.

Wraith is created at where it was expected to be, but Terran machine shop isn't created well.

[attach=9493]

Wraith doesn't affect the bug.

Trigger looks like:

Code
Trigger("Player 1"){
Conditions:
    Always();
    Elapsed Time(At least, 2);

Actions:
    Move Location("Player 9", "Map Revealer", "ddrr", "X");
    Move Location("Player 9", "Map Revealer", "X", "Y");
    Move Location("Player 9", "Map Revealer", "Y", "Main");
    Create Unit("Player 1", "Terran Wraith", 1, "Main");
    Create Unit("Player 1", "Terran Machine Shop", 1, "Main");
}

//-----------------------------------------------------------------//




and the map looks like this.

[attach=9492]

Attachments:
test2.png
Hits: 0 Size: 43.53kb
overview.jpg
Hits: 0 Size: 38.38kb
lgridtest.scm
Hits: 1 Size: 34.71kb

Post has been edited 3 time(s), last time on May 16 2014, 1:25 am by trgk.



EUD

May 16 2014, 1:24 am trgk Post #2



Solved. Bug of location grid techniques.

(This seems to be in fact a bug of Starcraft. Starcraft is inconsistent for including right edge in the location.
But anyway, we cannot fix SC. So this should be regarded as a bug of location grid techniques itself.)


SC Location shifting works by the following way.
(Not exact code, but it works like this)

Code
 width = location.right - location.left;
 if(location.left < 0) {
   location.left = 0
   location.right = width;
 }

 if(location.right [b]>=[/b] mapwidth) {     // right edges are included in location.
   location.right = mapwidth - 1;
   location.left = location.right - width;
 }



In my map, location X has width 2048 (left = 0, right = 2048)
After move location:

- location.left = -1
- location.right = 2047

weird. So location main is centered at (1023, 1023), shifted one pixel up and left from the intended position.
Buildings created with triggers seems to snap to grid by flooring coordinates, so 64*64 box centered at (1023, 1023) is
( 991, 991 ) ~ ( 1055, 1055 )

After flooring by unit 32:
( 960, 960 ) ~ ( 1024, 1024 )

So buildings are built at some weird position.

Post has been edited 4 time(s), last time on May 16 2014, 9:29 am by trgk.



EUD

May 16 2014, 8:03 am Wormer Post #3



Weird. Actually I myself had some problems with this in the past. Never really figured out what was happening, but I think move location works fine, it's just the problem of rounding, because 2028 pixels wide location doesn't have a middle.



Some.

May 26 2014, 10:15 am Sacrieur Post #4

Still Napping

Quote from trgk
weird. So location main is centered at (1023, 1023), shifted one pixel up and left from the intended position.

http://www.staredit.net/topic/14204/



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[09:24 pm]
Moose -- denis
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[2024-4-18. : 10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[2024-4-18. : 10:11 pm]
Ultraviolet -- :P
[2024-4-18. : 10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
Please log in to shout.


Members Online: C(a)HeK, Roy, RIVE