Kingsley1997 39 Posted December 8, 2015 So I'm building a function that generates grid markers around a center and radius. The script I have so far is the following, however it creates a cross on the map like "+" since I don't know how to do it in a circle. Any mathematicians know how to do this? private ["_center","_radius"]; _center = _this select 0; _radius = _this select 1; _gridSize = 50; for "_i" from 1 to (_radius / _gridSize) do { _top = [_center select 0, (_center select 1) + _gridSize * _i]; _bottom = [_center select 0, (_center select 1) - _gridSize * _i]; _left = [(_center select 0) - _gridSize * _i, _center select 1]; _right = [(_center select 0) + _gridSize * _i, _center select 1]; { _px = floor ((_x select 0) / 100); _py = floor ((_x select 1) / 100); _name = format ["grid_%1_%2", _px, _py]; createMarker[_name, [(_px * 100) + 50, (_py * 100) + 50, 0]]; _name setMarkerShape "RECTANGLE"; _name setMarkerSize [50,50]; _name setMarkerColor "ColorBlue"; // Need correct colour _name setMarkerAlpha 1; } forEach [_top, _bottom, _left, _right]; }; Share this post Link to post Share on other sites
austin_medic 109 Posted December 8, 2015 I suck at math but I gutted a BIS function that did that exactly, and got this (it was the VRBorders function I believe, and the physical objects it spawned were inadequate so I made my own function out of it with markers instead of objects): //private ["_pos1", "_unit","_rds", "_steps", "_radStep", "_pos2", "_wall", "_ret"]; _pos1 = [_this,0,position player,[[]]] call BIS_fnc_param; _rds = [_this,1,700,[0]] call BIS_fnc_param; _unit = [_this,2,objNull,[objNull]] call BIS_fnc_param; _ret = []; _steps = floor ((2 * pi * _rds) / 40); _radStep = 360 / _steps; for [{_i = 0}, {_i < 360}, {_i = _i + _radStep}] do { //for [{_x = 0}, {_x <= 300}, {_x = _x + 100}] do { for [{_x = 0}, {_x <= 0}, {_x = _x + 100}] do { _pos2 = [_pos1, _rds, _i] call BIS_fnc_relPos; _gib = round(random 500000); _text = format["%1_%2",name _unit,_gib]; _wall = createMarker[_text,_pos2]; _wall setMarkerShape "ICON"; _wall setMarkerType "mil_dot"; _ret set[count _ret,_wall]; }; }; _ret; the _unit var is probably moot for your purposes and it creates markers around the center position using the radius, so it'll need some tweaks Share this post Link to post Share on other sites
Kingsley1997 39 Posted December 8, 2015 I suck at math but I gutted a BIS function that did that exactly, and got this (it was the VRBorders function I believe, and the physical objects it spawned were inadequate so I made my own function out of it with markers instead of objects): //private ["_pos1", "_unit","_rds", "_steps", "_radStep", "_pos2", "_wall", "_ret"]; _pos1 = [_this,0,position player,[[]]] call BIS_fnc_param; _rds = [_this,1,700,[0]] call BIS_fnc_param; _unit = [_this,2,objNull,[objNull]] call BIS_fnc_param; _ret = []; _steps = floor ((2 * pi * _rds) / 40); _radStep = 360 / _steps; for [{_i = 0}, {_i < 360}, {_i = _i + _radStep}] do { //for [{_x = 0}, {_x <= 300}, {_x = _x + 100}] do { for [{_x = 0}, {_x <= 0}, {_x = _x + 100}] do { _pos2 = [_pos1, _rds, _i] call BIS_fnc_relPos; _gib = round(random 500000); _text = format["%1_%2",name _unit,_gib]; _wall = createMarker[_text,_pos2]; _wall setMarkerShape "ICON"; _wall setMarkerType "mil_dot"; _ret set[count _ret,_wall]; }; }; _ret; the _unit var is probably moot for your purposes and it creates markers around the center position using the radius, so it'll need some tweaks Wow thank you very much! :D I'll see how this goes Share this post Link to post Share on other sites
Kingsley1997 39 Posted December 8, 2015 Got it working, script below: private ["_center", "_radius","_steps", "_radStep", "_pos", "_text", "_block"]; _center = param [0, (position player)]; _radius = param [1, 500]; for [{_r = _radius}, {_r > 0}, {_r = _r - 100}] do { _steps = floor ((2 * pi * _r) / 50); // 40 _radStep = 360 / _steps; for [{_i = 0}, {_i < 360}, {_i = _i + _radStep}] do { for [{_x = 0}, {_x <= 0}, {_x = _x + 100}] do { _pos = [_center, _r, _i] call BIS_fnc_relPos; _px = floor ((_pos select 0) / 100); _py = floor ((_pos select 1) / 100); _text = format ["Grid_%1_%2", _px, _py]; _block = createMarker[_text, [(_px * 100) + 50, (_py * 100) + 50, 0]]; _block setMarkerShape "RECTANGLE"; _block setMarkerSize [50, 50]; _block setMarkerColor "ColorUNKNOWN"; // Need correct colour _block setMarkerAlpha 0.5; }; }; }; Share this post Link to post Share on other sites