User Tools

Site Tools


crpl:docs:createunit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
crpl:docs:createunit [2013/01/18 12:56] grauniadcrpl:docs:createunit [2020/05/30 11:18] (current) Sanian
Line 1: Line 1:
-~~DISCUSSION~~ 
 <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]] <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]]
 =====  CreateUnit  ===== =====  CreateUnit  =====
  
 ^Arguments^Result^Notation^ ^Arguments^Result^Notation^
-|Unit Name and coordinates| Unit UID |''s1 i1 i2 -- i3''|+|Unit type, X, Y| Unit UID |''s1 i1 i2 -- i3''|
  
  
 === Description === === Description ===
-Creates a unit at the specified coordinates Unit names must be one of the follow strings Names are NOT case sensitive. +Creates a unit at the given coordinates of the specified type. 
- +A list of all applicable Unit Types can be found on the following [[crpl:docs:getunittype#unit_types|page]].
-  * CRPLCORE +
-  * COLLECTOR +
-  * RELAY +
-  * REACTOR +
-  * OREMINE +
-  * SIPHON +
-  * TERP +
-  * GUPPY +
-  * PULSECANNON +
-  * MORTAR +
-  * STRAFER +
-  * BOMBER +
-  * SPRAYER +
-  * NULLIFIER +
-  * SHIELD +
-  * BEAM +
-  * SNIPER +
-  * BERTHA +
-  * POWERZONE +
-  * OREDEPOSIT +
-  * ENERGYDEPOSIT0 +
-  * ENERGYDEPOSIT1 +
-  * ENERGYDEPOSIT2 +
-  * ENERGYDEPOSIT3+
  
 === Examples === === Examples ===
 +The examples below are using [[crpl:docs:setscriptvar|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 [[crpl:docs:setscriptvar#list_of_vars|here]].
 +
 <code> <code>
 "CRPLCORE" 10 10 CreateUnit ->unitUID "CRPLCORE" 10 10 CreateUnit ->unitUID
 </code>  </code> 
 +<code>
 +# 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
 +</code>
crpl/docs/createunit.1358531815.txt.gz · Last modified: 2014/10/01 15:02 (external edit)