Tory Xiao 5 Posted September 29, 2021 How do I get a positions array of several objects using copytoClipboard in the editor? Share this post Link to post Share on other sites
Tory Xiao 5 Posted September 29, 2021 Im trying { if (!isPlayer _x) then { _npcPos = getPosATL _x; }; } forEach entities "car"; copyToClipboard _npcPos; But it returns nothing Share this post Link to post Share on other sites
Harzach 2518 Posted September 29, 2021 No need for a player check if you are already sorting entities for "CAR." Also, copyToClipboard takes a string. _posArray = []; { _pos = getPosATL _x; _posArray pushBack _pos; } forEach entities "car"; copyToClipboard str _posArray; I dropped five Hunters randomly on the map. The above code returns: [[820.988,701.823,-0.00175762],[624.936,1078,-0.00216675],[1195.94,692.019,-0.00145912],[1372.38,1086.57,-0.000517845],[1013.36,1405.16,-0.00107384]] 1 Share this post Link to post Share on other sites
Tory Xiao 5 Posted September 29, 2021 1 hour ago, Harzach said: No need for a player check if you are already sorting entities for "CAR." Also, copyToClipboard takes a string. _posArray = []; { _pos = getPosATL _x; _posArray pushBack _pos; } forEach entities "car"; copyToClipboard str _posArray; I dropped five Hunters randomly on the map. The above code returns: [[820.988,701.823,-0.00175762],[624.936,1078,-0.00216675],[1195.94,692.019,-0.00145912],[1372.38,1086.57,-0.000517845],[1013.36,1405.16,-0.00107384]] Thanks! Another question, how do I get the position in 2D [x,y] format? getPos, getPosASL, getPosATL... all return 3D coordinates Share this post Link to post Share on other sites
Harzach 2518 Posted September 29, 2021 _posArray = []; { _pos = getPosATL _x; _pos deleteAt (count _pos -1); _posArray pushBack _pos; } forEach entities "car"; copyToClipboard str _posArray; Untested, but should work. I use "(count _pos -1)" instead of just "2" as the latter is apparently very performance heavy RE: the Biki. See the last comment here: https://community.bistudio.com/wiki/deleteAt *edit* - tested OK 2 Share this post Link to post Share on other sites
wogz187 1086 Posted September 29, 2021 Convert just about anything into a position array, you_convertToPos={ private _pos= objNull; if (typeName _this== "ARRAY") exitWith {_this}; if (typeName _this== "LOCATION") exitWith {_pos = locationPosition _this; _pos}; if !(typeName _this== "STRING") then {_pos = (_this ModelToWorld [0,0,0])} else {_pos = (getMarkerPos [_this, true])} _pos }; Example: _arr =[(nearestLocation [getPos player, "nameCity"]), (player modelToWorld [0,3,0]), trigger_0, "marker_0"] apply {systemChat str (_x call you_convertToPos)}; Have fun! 2 Share this post Link to post Share on other sites
pierremgi 4913 Posted September 29, 2021 the question is: what for? 1 Share this post Link to post Share on other sites