CreateUnit

Parameters
id player

The owner of the unit.

unitid integer

The rawcode of the unit.

x real

The x-coordinate of the unit.

y real

The y-coordinate of the unit.

face real

Unit facing in degrees.

  • 0 = East
  • 90 = North
  • 180 = West
  • 270 = South
  • -90 = South (wraps around)
comment

Creates a unit of type unitid for player id, facing a certain direction at the provided coordinates. Returns handle to unit.

Example: Create a human footman for first player (red) at map coordinates -30, 0, facing north:

    // Jass
    call CreateUnit(Player(0), 'hfoo', -30, 0, 90)
    -- Lua
    CreateUnit(Player(0), FourCC("hfoo"), -30, 0, 90)
note

See: bj_UNIT_FACING constant for default facing direction of units in BJ scripts and GUI.

return type
unit
Source code
native CreateUnit takes player id, integer unitid, real x, real y, real face returns unit
Source
unit.j
wc3modding.com
CreateUnit