User Tools

Site Tools


4rpl:commands:createunitonterrain

Differences

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

Link to this comparison view

Next revision
Previous revision
4rpl:commands:createunitonterrain [2021/01/08 16:01] – external edit 127.0.0.14rpl:commands:createunitonterrain [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
-<=[[4rpl:start| Index]]+<=[[4rpl:start| Index]]\\ 
 +<= [[4rpl:start#Unit]] 
  
 ====== CreateUnitOnTerrain ====== ====== CreateUnitOnTerrain ======
Line 6: Line 8:
  
 ===== Description ===== ===== 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.+Creates a unit from a CMOD UID (GUID)((You can get the GUID from within the CPACK manager. 
 +GUIDs are unique to each custom unit and never change.)) or from an internal unit name((See [[4rpl:commands:unit_types|UnitTypes]]  
 +for a list of these names.)).  
 + 
 +initParams is 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 will be placed on the terrain at the supplied terrain cell coordinates. The unit will be placed on the terrain at the supplied terrain cell coordinates.
-The lower left corner of the map is 0,0 and the top right is mapWidth,mapLength. The unit will be placed at a height (the Y position) based on the terrain +The lower left corner of the map is 0,0 (0:0) and the top right is mapWidth,mapLength.  
-height at the specified coordinates.\\+The unit will be placed at a height (the Y position) based on the terrain 
 +height at the specified coordinates. 
 The unit UID will be pushed to the stack. If the unit can not be created, -1 is pushed to the stack. The unit UID will be pushed to the stack. If the unit can not be created, -1 is pushed to the stack.
 +See [[CreateUnit]] for more details.
  
 ===== Examples ===== ===== Examples =====
Line 17: Line 27:
 CreateUnitOnTerrain(<-cmodUID 42 23 0) ->unitUID CreateUnitOnTerrain(<-cmodUID 42 23 0) ->unitUID
 </code> </code>
 +
 +=== See Also ===
 +  * [[4rpl:commands:CreateUnit]]
 +
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
4rpl/commands/createunitonterrain.1610121708.txt.gz · Last modified: 2025/02/14 14:56 (external edit)