This is an old revision of the document!
~~DISCUSSION~~ <- CRPL reference <- Unit Commands
| Arguments | Result | Notation |
|---|---|---|
| Coordinates, range, square? | Number of units in range | x1 y1 f1 b1 – u1 u2… un n |
Returns the unit UID's of all units (including player/enemy and flying/landed) that are within range. The function pushes the n UID's onto the stack followed by the integer n, where n is the number of units.
If “square?” is set to TRUE, the command uses a square range instead of the usual circular one.
Find all CRPL cores on the map
#Standard Notation once 0 0 9999 TRUE GetAllUnitsInRange 0 do ->unit <-unit GetUnitType "CRPLCORE" eq if "Found a CRPL core: " <-unit Trace2 endif loop endonce
#Warp Notation
once
GetAllUnitsInRange(0 0 9999 TRUE) 0 do
->unit
if(GetUnitType(<-unit) "CRPLCORE" eq)
Trace2("Found a CRPL core: " <-unit)
endif
loop
endonce
Destroy every unit in range of the core this script is attached to
#Standard Notation
CurrentCoords 10 FALSE GetAllUnitsInRange 0 do
->unit
<-unit CONST_DESTROYMODE GetUnitAttribute ->destroyMode
<-unit <-destroyMode Destroy
loop