- [[.:prplreference| PRPL reference]] <- [[.:prplreference#units|Units]]
===== CreateUnit =====
^Arguments^Result^Notation^
| Unit Type, X cell coord, Y cell coord | UID | [ s1 i1 i2 - i3 ] |
=== Description ===
Creates a unit of type ''s1'' at cell coordinates ''i1'',''i2''. Returns the UID of the created unit, or -1 if the command fails. A list of unit types can be found [[.:unittypelist|here]]. Note that unit type strings are case-sensitive.
=== Examples ===
# Create a PRPL core at map cell 1,1
CreateUnit("PRPLCORE" 1 1) ->UID
i2 = GetIntFromStack(); //Y cell
i1 = GetIntFromStack(); //X cell
s1 = GetStringFromStack(); //Unit Name
stack.Push(new Data(unit.UID));
stack.Push(new Data(-1));