Arma 3 Scripting

drawIcon

  • Local effect
  • Arma 3 v0.50
  • First in Armed Assault v1.00

Command · Markdown · JSON · original wiki page

Description

Draws an icon on the map. As this command needs to be called every frame, it is preferable using the onDraw UI Event Handler.

Note

Some useful icons can be found in configFile >> "CfgVehicleIcons".

Syntax

map drawIcon [texture, color, position, width, height, angle, text, shadow, textSize, font, align]

Parameters:

Returns: Nothing

Examples

Example 1

Red icon with text:

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
    _this select 0 drawIcon [
        "iconStaticMG", // custom images can also be used: getMissionPath "\myFolder\myIcon.paa"
        [1,0,0,1],
        getPosASLVisual player,
        24,
        24,
        getDirVisual player,
        "Player Vehicle",
        1,
        0.03,
        "TahomaB",
        "right"
    ]
}];

Example 2

Green text only:

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
    _this select 0 drawIcon [
        "#(rgb,1,1,1)color(1,1,1,1)",
        [0,1,0,1],
        player,
        0,
        0,
        0,
        name player
    ]
}];

See also

drawArrow · drawEllipse · drawLine · drawRectangle · drawPolygon · drawTriangle · drawXPolygon

Community notes

Leopard20

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:

private _scale = 6.4 * worldSize / 8192 * ctrlMapScale _map;
private _size = _sizeInMeters / _scale;

For example, the following icon has an exact size of 50 meters on the map, even after zooming in/out:

private _scale = 6.4 * worldSize / 8192 * ctrlMapScale _map;
private _size = 50 / _scale;
_map drawIcon ["iconStaticMG", [1,0,0,1], getPosASLVisual player, _size, _size, 0]