FANDOM


The CreateUnit native creates a unit. It is defined as follows:

native CreateUnit takes player id, integer unitid, real x, real y, real face returns unit

The parameters are as follows:

player 'id' (The player for whom the unit is to be created)

integer 'unitid' (the unit type id of the unit to be created)

real 'x' (the x coordinate at which the unit should be placed)

real 'y' (the y coordinate at which the unit should be placed)

real 'face' (the angle, in degrees, that the unit should initially face)

Example call:

local unit u = CreateUnit( Player(0), 'hfoo', GetRectCenterX(someRect), GetRectCenterY(someRect), bj_UNIT_FACING )