Index
Unit

CreateUnit

CreateUnit(<-CModUID <-pos <-initParams) ->unitUID

Description

Creates a unit from a CMOD UID (a unit template defined in a CPACK referred to as GUID). You can get the GUID from within the CPACK manager. GUIDs are unique and never change. The CMOD UID can also be a name that specifies the name of an internal unit. See Unit Types for a list of the names.
The unit will be placed at the supplied 3D vector position.
The initParams are a table that contains a set of variables that will be set on the newly created unit. See GetUnitSettings for a list of the data names that can be specified in the initData table when creating built in units.
The unit UID will be pushed to the stack. If the unit can not be created, -1 is pushed to the stack.

:NOTE: When creating spores, keep in mind that they have a max height of 60.5 for their ballistic arc. If they are created above this height there will be no solution to the ballistic arc, causing the spore to pop at its created position.

Examples

"abcdefgh1234567" ->cmodUID
CreateTable ->initParams
"42" ->initParams{"Foo"}
"HHGTTG" ->initParams{"Bar"}
CreateUnit(<-cmodUID V3(10 5 20) <-initParams) ->unitUID

See Also

Index