Jump to content

Recommended Posts

Hello, I am trying to split the map into columns and create a marker representing each column.

 

My script is working, but its not working as intended, the columns are not positioned correctly.

_path = configfile >> "cfgworlds" >> worldname;
_size = getnumber (_path >> "mapSize");
_size = _size / 2;
_center = [_size,_size,0];

_columnsAmount = 8;
_xCrd = _size / _columnsAmount;
_add = _size / _columnsAmount;

_middleHeight = _size / 2;

for "_i" from 1 to _columnsAmount do 
{
	_marker = createMarker ["Column_" + str _i, [(_xCrd/2), _middleHeight]];
	_marker setMarkerSize [_xCrd/2, _size];
	_marker setMarkerShape "rectangle";
	_marker setMarkerColor selectRandom["ColorRed", "ColorYellow", "ColorBlue", "ColorGreen", "ColorPink"];
	_marker setMarkerAlpha 0.5;

	_xCrd = _xCrd + _add;
};

 

Share this post


Link to post
Share on other sites

Update:

 

I managed to get it working, but one more issue:

Spoiler

_path = configfile >> "cfgworlds" >> worldname;
_size = getnumber (_path >> "mapSize");

_columnsAmount = 8;
_columnWidth = _size / _columnsAmount;
_xOffset = (_size - (_columnsAmount * _columnWidth)) / 2;
_yOffset = _size / 2;

for "_i" from 1 to _columnsAmount do 
{
	_xCrd = (_i - 0.5) * _columnWidth + _xOffset;
	_marker = createMarker ["Column_" + str _i, [_xCrd, _yOffset]];
	_marker setMarkerSize [_columnWidth, _size];
	_marker setMarkerShape "rectangle";
	_marker setMarkerColor selectRandom ["ColorRed", "ColorYellow", "ColorBlue", "ColorGreen", "ColorPink"];
	_marker setMarkerAlpha 0.5;
};

 

 

I've added a picture below to show that the column markers extend beyond the map above and below, is there any way I can adjust to the exact size of the map?

https://imgur.com/a/DDVhBmf

Share this post


Link to post
Share on other sites
private _size =  worldSize;
private _columnsAmount = 8;
private _middleHeight = _size/2;
private _width =  _size/_columnsAmount;
private "_marker";
for "_i" from 1 to _columnsAmount do  {
   _marker = createMarker ["Column_" + str _i, [_width* (-0.5+_i),_middleHeight]];
   _marker setMarkerSize [_width/2,_middleHeight];
   _marker setMarkerShape "rectangle";
   _marker setMarkerColor selectRandom ["ColorRed", "ColorYellow", "ColorBlue", "ColorGreen", "ColorPink"];
   _marker setMarkerAlpha 0.5;  
};

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
6 minutes ago, pierremgi said:

private _size =  worldSize;
private _columnsAmount = 8;
private _middleHeight = _size/2;
private _width =  _size/_columnsAmount;
private "_marker";
for "_i" from 1 to _columnsAmount do  {
   _marker = createMarker ["Column_" + str _i, [_width* (-0.5+_i),_middleHeight]];
   _marker setMarkerSize [_width/2,_middleHeight];
   _marker setMarkerShape "rectangle";
   _marker setMarkerColor selectRandom ["ColorRed", "ColorYellow", "ColorBlue", "ColorGreen", "ColorPink"];
   _marker setMarkerAlpha 0.5;  
};

 

Thank you, I appreciate it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×