Page tree
Skip to end of metadata
Go to start of metadata

Introduced in




Defines an icon that is attached to the specified Editor Object, and which is visible on the 2D / 3D map (they are not shown on maps in user dialogs or on the mini-map).

With the new symbology in VBS3 20.2+ / VBS4 20.1+, you can no longer use the command to override map icons for units and vehicles.

Just like all the other draw commands, this one needs to be refreshed every frame, in order to be visible (see drawLine for details).

Icon size is specified as a "radius" (similar to setMarkerSize and setTriggerArea), where the dimension specified the half the final size. Icons that are not auto-scaled always keep their absolute size (in meters), and become smaller as the map is zoomed out, and bigger as it is zoomed in. The size of non-scaled icons though is smaller than specified, so to reach the exact, required size it must be multiplied by 1.28.

Auto-scaled icons always keep the same size in relation to the screen, and have their nominal size only at a ctrlMapScale of 1500 (to fill the whole screen height, an auto-scaled marker needs a height of about 450) (be aware though, that most icon bitmaps have an empty margin around the image itself, so the final size is still most likely somewhat smaller than specified). Auto-scaling can also be dependent on the current map scale, in order to prevent an icon to become unproportionally large when zooming out. In order to do that, the threshold zoom factor, multiplied by 5, should be specified using the autoscale parameter.


If an icon should keep its size (relative to the screen), until the ctrlMapScale reaches 0.5, then the autoscale parameter should be 2.5.


Syntax:map setDrawIcon [object, icon, color, offset, width, height, maintsize, autoscale, angle, identifier, shadow, text, is3D, drawline, priority]
  • map: Control - Map control to draw on (only works with editor map).
  • object: Editor Object - Editor Object the icon is attached to.
  • icon: String - Icon to display. Can either be a Procedural Textures or a path. If using a procedural color, then all channels should be set to 1 (color(1,1,1,1)), so that the following color parameter works correctly. If a path is specified, then it can either refer to an absolute path on a local drive (path must start with the drive letter), or to an addon path (no drive letter).
  • color: Color - Color applied to non-transparent parts of the icon, as well as the text label. For 3D icons, the specified color is only used when the object is not selected. Otherwise, it is yellow, when the cursor is over the object, and green when it is selected.
  • offset: Array - Offset from object (in meters) for [x,y,z]. The z-value only has an effect for 3D icons.
  • width: Number - Horizontal icon "radius".
  • height: Number - Vertical icon "radius" of icon.
  • maintsize (VBS3 20.2+)Number - Icon size to maintain.
  • autoscale: Boolean or Number - If true, the icon scales with the map when zooming in / out, to keep its size relative to the screen. If false, then the icon absolute size always be the same, relative to the screen. If a Number, the icon maintains its size, if the map scale is less than that number (3D icons are always auto-scaled).
  • angle: Number - Non-functional.
  • identifier: String - Icon identifier. Can be used with removeDrawIcon. Must be unique to create a new icon (otherwise, the existing icon is modified with the new settings).
  • shadow: Boolean - If true, then black parts of the icon are drawn in a darker shade.
  • text: String - Text which appears next to the icon. Text size is always the same, even when autoscale is on.
  • is3D: Boolean - If true, then the icon is only visible on the 3D editor map, if false then it is only visible in 2D (optional, default: false).
  • drawline: Boolean - Used only with 3D icons. If true, then a line is drawn from the icon closest to the camera, to the assigned object (optional if is3D is not defined, mandatory if it is).
  • priority: Number - If the icons overlap, then the one with the lower priority value is drawn on top. If priority values are the same, then the draw order is undefined (unpredictable) (optional, default: 0).
Return Value:Nothing


Creates a 2D icon at the unit location:
map setDrawIcon ["_unit_3", "\vbs2\ui\data\cursor_basic_ca.paa", [1,0,0,1], [0,0,0], 50, 50, 0, "Icon1", false, ""]; // before VBS3 20.2
map setDrawIcon ["_trigger_0", "\vbs2\ui\data\marker_dot_ca.paa", [1,0,0,1], [0,0,0], 50, 50, 0.4, 0, "Icon1", false, ""]; // in VBS3 20.2+

Additional Information

See also: removeDrawIcon, drawIcon