{"name":"drawXPolygon","title":"drawXPolygon","type":"command","url":"https://community.bistudio.com/wiki/drawXPolygon","revid":377556,"updated":"2026-01-02T06:54:57Z","groups":["GUI Control - Map"],"status":"ok","games":{"arma3":"2.20"},"since":"arma3 2.20","arma3_since":"2.20","description":"Draws an N sided polygon on the map.","syntaxes":[{"syntax":"map drawXPolygon [n, centre, a, b, angle, color, fill, alignWithMap]","params":[{"name":"map","type":"Control","type_expr":"Control"},{"name":"n","type":"Number","description":"number of sides 3..720","type_expr":"Number"},{"name":"centre","type":"Object or Position2D, Position3D","description":"ellipse's centre","type_expr":"Object | Position2D | Position3D"},{"name":"a","type":"Number","description":"horizontal (x) radius","type_expr":"Number"},{"name":"b","type":"Number","description":"vertical (y) radius","type_expr":"Number"},{"name":"angle","type":"Number","description":"angle of rotation in degrees","type_expr":"Number"},{"name":"color","type":"Color (RGBA)","description":"line color","type_expr":"Color"},{"name":"fill","type":"String","description":"fill texture file or Procedural Textures. Note that the file texture will not rotate with polygon, use drawIcon for that. If fill texture is not empty, set line color to white [1,1,1,1]","type_expr":"String"},{"name":"alignWithMap","type":"Boolean","optional":true,"default":"true","description":"when false the shape will not follow map rotation.","type_expr":"Boolean","text":"alignWithMap: Boolean - (Optional, default true) - when false the shape will not follow map rotation."}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"map"},"right":{"text":"[n, centre, a, b, angle, color, fill, alignWithMap]"}}],"examples":[{"text":"```sqf\nfindDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\",\n{\n    _this select 0 drawXPolygon [\n        5, player, 50, 10, 0, [1, 0, 0, 1], \"\"\n    ];\n    _this select 0 drawXPolygon [\n        3, player, 10, 50, 0, [1, 1, 1, 1], \"#(rgb,8,8,3)color(1,0.6,0,1)\"\n    ];\n    _this select 0 drawXPolygon [\n        12, player, 10, 10, 90, [0, 0, 1, 1], \"\"\n    ];\n}];\n```","code":["findDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\", \n{\n\t_this select 0 drawXPolygon [\n\t\t5, player, 50, 10, 0, [1, 0, 0, 1], \"\"\n\t];\n\t_this select 0 drawXPolygon [\n\t\t3, player, 10, 50, 0, [1, 1, 1, 1], \"#(rgb,8,8,3)color(1,0.6,0,1)\"\n\t];\n\t_this select 0 drawXPolygon [\n\t\t12, player, 10, 10, 90, [0, 0, 1, 1], \"\"\n\t];\n}];"]}],"see_also":["drawArrow","drawIcon","drawLine","drawRectangle","drawPolygon","drawTriangle","drawEllipse"]}