{"name":"drawIcon","operator":null,"title":"drawIcon","type":"command","url":"https://community.bistudio.com/wiki/drawIcon","revid":378474,"updated":"2026-04-24T11:03:12Z","groups":["GUI Control - Map"],"status":"ok","replaced_by":[],"games":[{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma1","name":"Armed Assault","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":"local","server_exec":false},"exec":null,"description":"Draws an icon on the map.\nAs this command needs to be called every frame, it is preferable using the onDraw UI Event Handler.\n\n> [!NOTE]\n> Some useful icons can be found in `configFile >> \"CfgVehicleIcons\"`.","syntaxes":[{"syntax":"map drawIcon [texture, color, position, width, height, angle, text, shadow, textSize, font, align]","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":"texture","type":"String","optional":false,"default":null,"description":"icon texture","types":["String"],"since":null,"text":"texture: String - icon texture"},{"name":"color","type":"Color (RGBA)","optional":false,"default":null,"description":"text and icon color","types":["Color"],"since":null,"text":"color: Color (RGBA) - text and icon color"},{"name":"position","type":"Object, Position2D or Position3D","optional":false,"default":null,"description":null,"types":["Object","Position2D","Position3D"],"since":null,"text":"position: Object, Position2D or Position3D"},{"name":"width","type":"Number","optional":false,"default":null,"description":"width of the icon (but not the text)","types":["Number"],"since":null,"text":"width: Number - width of the icon (but not the text)"},{"name":"height","type":"Number","optional":false,"default":null,"description":"height of the icon (but not the text)","types":["Number"],"since":null,"text":"height: Number - height of the icon (but not the text)"},{"name":"angle","type":"Number","optional":false,"default":null,"description":"rotation angle of the icon not the text (add to it ctrlMapDir to show correctly on rotating minimap)","types":["Number"],"since":null,"text":"angle: Number - rotation angle of the icon not the text (add to it ctrlMapDir to show correctly on rotating minimap)"},{"name":"text","type":"String","optional":true,"default":"\"\"","description":null,"types":["String"],"since":null,"text":"text: String - (Optional, default \"\")"},{"name":"shadow","type":"Number or Boolean","optional":true,"default":"false","description":"can be one of:\n- 0 (false): no shadow\n- 1: shadow (for text)\n- 2 (true): outline (works for text and for icon only if icon angle is 0)","types":["Number","Boolean"],"since":null,"text":"shadow: Number or Boolean - (Optional, default false) can be one of:\n- 0 (false): no shadow\n- 1: shadow (for text)\n- 2 (true): outline (works for text and for icon only if icon angle is 0)"},{"name":"textSize","type":"Number","optional":true,"default":"-1","description":"size of the text in UI units","types":["Number"],"since":"arma3 0.72","text":"textSize: Number - (Optional, default -1) size of the text in UI units"},{"name":"font","type":"String","optional":true,"default":"\"\"","description":"text's font","types":["String"],"since":"arma3 0.72","text":"font: String - (Optional, default \"\") text's font"},{"name":"align","type":"String","optional":true,"default":"\"right\"","description":"text alignment. Can be:\n- \"left\"\n- \"right\"\n- \"center\"","types":["String"],"since":"arma3 0.72","text":"align: String - (Optional, default \"right\") text alignment. Can be:\n- \"left\"\n- \"right\"\n- \"center\""}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"map","types":["Control"]},"right":{"text":"[texture, color, position, width, height, angle, text, shadow, textSize, font, align]","types":["Array"]}}],"examples":[{"text":"Red icon with text:\n\n```sqf\nfindDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\", {\n    _this select 0 drawIcon [\n        \"iconStaticMG\", // custom images can also be used: getMissionPath \"\\myFolder\\myIcon.paa\"\n        [1,0,0,1],\n        getPosASLVisual player,\n        24,\n        24,\n        getDirVisual player,\n        \"Player Vehicle\",\n        1,\n        0.03,\n        \"TahomaB\",\n        \"right\"\n    ]\n}];\n```","code":["findDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\", {\n\t_this select 0 drawIcon [\n\t\t\"iconStaticMG\", // custom images can also be used: getMissionPath \"\\myFolder\\myIcon.paa\"\n\t\t[1,0,0,1],\n\t\tgetPosASLVisual player,\n\t\t24,\n\t\t24,\n\t\tgetDirVisual player,\n\t\t\"Player Vehicle\",\n\t\t1,\n\t\t0.03,\n\t\t\"TahomaB\",\n\t\t\"right\"\n\t]\n}];"]},{"text":"Green text only:\n\n```sqf\nfindDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\", {\n    _this select 0 drawIcon [\n        \"#(rgb,1,1,1)color(1,1,1,1)\",\n        [0,1,0,1],\n        player,\n        0,\n        0,\n        0,\n        name player\n    ]\n}];\n```","code":["findDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\", {\n\t_this select 0 drawIcon [\n\t\t\"#(rgb,1,1,1)color(1,1,1,1)\",\n\t\t[0,1,0,1],\n\t\tplayer,\n\t\t0,\n\t\t0,\n\t\t0,\n\t\tname player\n\t]\n}];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["drawArrow","drawEllipse","drawLine","drawRectangle","drawPolygon","drawTriangle","drawXPolygon"],"notes":[{"user":"Benargee","date":"2016-01-04T05:41:00Z","text":"Arma 3 1.54\n\nThis command does not seem to play nice with onEachFrame. It seems to draw on the main screen while maintaing position relative to the map position\n\nExample:\n\n```sqf\nonEachFrame {\n    findDisplay 12 displayCtrl 51 drawIcon ['iconStaticMG', [1,0,0,1], getPosASL player, 24, 24, getDir player, 'Player Vehicle', 1, 0.03, 'TahomaB', 'right'];\n};\n```"},{"user":"Leopard20","date":"2022-05-09T19:34:07Z","text":"The icon size always stays the same, even after zooming in/out. To make the icon get bigger with map zoom, use this for width and height size:\n\n```sqf\nprivate _scale = 6.4 * worldSize / 8192 * ctrlMapScale _map;\nprivate _size = _sizeInMeters / _scale;\n```\n\nFor example, the following icon has an exact size of 50 meters on the map, even after zooming in/out:\n\n```sqf\nprivate _scale = 6.4 * worldSize / 8192 * ctrlMapScale _map;\nprivate _size = 50 / _scale;\n_map drawIcon [\"iconStaticMG\", [1,0,0,1], getPosASLVisual player, _size, _size, 0]\n```"}],"categories":["ArmA: Armed Assault: New Scripting Commands","ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: GUI Control - Map","Introduced with Armed Assault version 1.00","Scripting Commands","Scripting Commands: Local Effect","Take On Helicopters: Scripting Commands"]}