User Tools

Site Tools


crpl:docs:createunit

<- CRPL reference <- Unit Commands

CreateUnit

ArgumentsResultNotation
Unit type, X, Y Unit UID s1 i1 i2 – i3

Description

Creates a unit at the given coordinates of the specified type. A list of all applicable Unit Types can be found on the following page.

Examples

The examples below are using SetScriptVar to change various attributes of regular units (not CRPL cores). You can find all the attributes of regular units you can change with SetScriptVar here.

"CRPLCORE" 10 10 CreateUnit ->unitUID
# Build an emitter or spore tower at current location.  (From Arca by virgilw.)
RandFloat ->rand
if (<-rand lt(0.5))
	CreateUnit("EMITTER" CurrentCoords) ->child
	SetScriptVar(<-child 0 "productionInterval" 10)
	SetScriptVar(<-child 0 "productionAmt" 25000000)
else
	CreateUnit("SPORETOWER" CurrentCoords) ->child
	SetScriptVar(<-child 0 "startTime" GetGameTimeFrames add (3600))
	SetScriptVar(<-child 0 "waveInterval" 3600)
	SetScriptVar(<-child 0 "waveCount" 1)
	SetScriptVar(<-child 0 "sporePayload" 25000000)
endif
crpl/docs/createunit.txt · Last modified: 2020/05/30 11:18 by Sanian