Coordinates

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Coordinates

Post by enric »

Coordinates.
I can manage to understand how coordinates are for BA.
I've an example:

the map says at the:
bottom left: 16, 16
top, left: 65, 16
bottom right: 16, 49
top, right: 65, 49

Width = GetMapWidth();
Height = GetMapHeight();
Width = 82
Height = 66
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Coordinates

Post by pipfromslitherine »

There is a 16 tile border around all maps.

Cheers

Pip
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Coordinates

Post by enric »

Yes but the Width and Height you get with the GetMapWidth call, are not the width or height of the play map, neither the width or height of the play map.
I see that Width = GetMapWidth() return the width of the play map more 17 (no more 34 (16 tile border around all maps)) and same with the height, very bizarre system.
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Coordinates

Post by pipfromslitherine »

If the map width is 82, then the tiles are numbered from 0 to 81 inclusive. The playable area will be tiles 16 to 65 inclusive. Similar for the vertical ordinates. The map is exactly the size returned by the functions - the playable area is exactly 16 in along each edge.

Cheers

Pip
buffpilot
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 14
Joined: Tue Aug 28, 2012 11:11 pm

Re: Coordinates

Post by buffpilot »

enric - what are you trying to get at?
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Coordinates

Post by enric »

buffpilot wrote:enric - what are you trying to get at?
Well, now it works (x), even with the … coordinates system.
I'll add to all my scenarios the text that indicates, in every border map, the compass (North, South, etc.)
This come to me when I wrote a AAR and I found complicated referring to something in the board without compass. (i.e Sherman attack comes from SW)

Now I've a functions that places, in the middle of every map border the corresponding compass coordinate.
buffpilot
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 14
Joined: Tue Aug 28, 2012 11:11 pm

Re: Coordinates

Post by buffpilot »

Neat - can you post the code?
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Coordinates

Post by pipfromslitherine »

We can pretty easily add a compass to the minimap or screen if it's something people think they would use a lot? Or I can just expose the camera facing via the scripting, and you can add whatever onscreen compass you like then :).

Cheers

Pip
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Coordinates

Post by enric »

buffpilot wrote:Neat - can you post the code?
It'll be included in every new scenario we are working.

//******************************************************************************
// * PlaceCompass
// ******************************************************************************
FUNCTION PlaceCompass (rotate)
{
int Nx;
int Ny;
int Sx;
int Sy;

int Ex;
int Ey;
int Wx;
int Wy;

int dummyX;
int dummyY;

int Width;
int Height;

Width = GetMapWidth();
Height = GetMapHeight();

Nx = Width/2;
Ny = 16;

Sx = Nx;
Sy = Height-17;

Ex = Width-17;
EY = Height/2;

Wx = 16;
Wy = Ey;

if ( rotate == 1)
{
DummyX = Nx;
DummyY = Ny;

Nx = Wx;
Ny = Wy;
Wx = Sx;
Wy = Sy;
Sx = Ex;
Sy = Ey;
Ex = DummyX;
Ey = DummyY;

}

if ( rotate == 2 )
{
DummyX = Nx;
DummyY = Ny;

Nx = Sx;
Ny = Sy;
Sx = DummyX;
Sy = DummyY;

DummyX = Ex;
DummyY = Ey;

Ex = Wx;
Ey = Wy;
Wx = DummyX;
Wy = DummyY;
}

if ( rotate == 3)
{
DummyX = Nx;
DummyY = Ny;

Nx = Ex;
Ny = Ey;
Ex = Sx;
Ey = Sy;
Sx = Wx;
Sy = Wy;

Wx = DummyX;
Wy = DummyY;
}

ShowTextMarker(1, Nx, Ny, "IDS_LOC_NORTH", 0, "FFFFFF", 1);
ShowTextMarker(2, Sx, Sy, "IDS_LOC_SOUTH", 0, "FFFFFF", 1);
ShowTextMarker(3, Ex, Ey, "IDS_LOC_EAST", 0, "FFFFFF", 1);
ShowTextMarker(4, Wx, Wy, "IDS_LOC_WEST", 0, "FFFFFF", 1);

}
Post Reply

Return to “Battle Academy : Modders Corner ”