{"name":"drawXPolygon","operator":null,"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","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.20"}],"since":{"game":"arma3","name":"Arma 3","version":"2.20"},"arma3_since":"2.20","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Draws an N sided polygon on the map.","syntaxes":[{"syntax":"map drawXPolygon [n, centre, a, b, angle, color, fill, alignWithMap]","since":null,"effect":null,"exec":null,"params":[{"name":"map","type":"Control","optional":false,"default":null,"description":null,"types":["Control"],"since":null,"text":"map: Control"},{"name":"n","type":"Number","optional":false,"default":null,"description":"number of sides 3..720","types":["Number"],"since":null,"text":"n: Number - number of sides 3..720"},{"name":"centre","type":"Object or Position2D, Position3D","optional":false,"default":null,"description":"ellipse's centre","types":["Object","Position2D","Position3D"],"since":null,"text":"centre: Object or Position2D, Position3D - ellipse's centre"},{"name":"a","type":"Number","optional":false,"default":null,"description":"horizontal (x) radius","types":["Number"],"since":null,"text":"a: Number - horizontal (x) radius"},{"name":"b","type":"Number","optional":false,"default":null,"description":"vertical (y) radius","types":["Number"],"since":null,"text":"b: Number - vertical (y) radius"},{"name":"angle","type":"Number","optional":false,"default":null,"description":"angle of rotation in degrees","types":["Number"],"since":null,"text":"angle: Number - angle of rotation in degrees"},{"name":"color","type":"Color (RGBA)","optional":false,"default":null,"description":"line color","types":["Color"],"since":null,"text":"color: Color (RGBA) - line color"},{"name":"fill","type":"String","optional":false,"default":null,"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]","types":["String"],"since":null,"text":"fill: String - 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]"},{"name":"alignWithMap","type":"Boolean","optional":true,"default":"true","description":"when false the shape will not follow map rotation.","types":["Boolean"],"since":null,"text":"alignWithMap: Boolean - (Optional, default true) - when false the shape will not follow map rotation."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"map","types":["Control"]},"right":{"text":"[n, centre, a, b, angle, color, fill, alignWithMap]","types":["Array"]}}],"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}];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["drawArrow","drawIcon","drawLine","drawRectangle","drawPolygon","drawTriangle","drawEllipse"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: GUI Control - Map","Introduced with Arma 3 version 2.20","Scripting Commands"]}