User Tools

Site Tools


4rpl:commands:createunit

This is an old revision of the document!


CREATEUNIT

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

Description

Creates a unit from a CMOD UID (a unit template defined in a CPACK). You can get the CMOD UID from within the CPACK manager. CMOD UIDs are unique and never change. 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.
The unit UID will be pushed to the stack. If the unit can not be created, -1 is pushed to the stack.

Examples

"abcdefgh1234567" ->cmodUID
CreateTable ->initParams
"42" ->initParams{"Foo"}
"HHGTTG" ->initParams{"Bar"}
CreateUnit(<-cmodUID V3(10 5 20) <-initParams) ->unitUID
4rpl/commands/createunit.1589462870.txt.gz · Last modified: 2025/02/14 14:56 (external edit)