This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 4rpl:commands:getunitsinrange [2021/01/25 17:39] – Karsten75 | 4rpl:commands:getunitsinrange [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| ===== Description ===== | ===== Description ===== | ||
| - | Returns list of units in range of a given position. The returned list is sorted so that the first item in the list is the closest.\\ | + | Returns list of units in range of a given position. The returned list is sorted so that the first item in the list is the closest. |
| - | * **startPos: | + | |
| - | * **range:** a floating point number that is the maximum distance from startPos.\\ | + | |
| - | * **isSquare: | + | |
| - | * **is3D:** a boolean. It determines if a true 3d distance is used for range, or if only the X and Z components (2D) distance calculation is used.\\ | + | |
| - | * **requireLOS: | + | |
| - | * **enemyState: | + | |
| - | * **builtState: | + | |
| - | * **imperviousState: | + | |
| - | :!: **Note: | + | :!: **Note: |
| + | Whether a custom unit occupies space can be controlled through the CMOD Settings: **Settings > Basic > " | ||
| + | |||
| + | For short range searches refer to the [[cw4: | ||
| + | |||
| + | |||
| + | ? startPos: | ||
| + | : a [[V3]] (vector3) indicating the point to search outwards from. | ||
| + | ? range: | ||
| + | : a floating point number that is the maximum distance from startPos. | ||
| + | ? isSquare: | ||
| + | : a boolean. It means to check in a square rather than a circle around startPos. For 3D checks, the vertical displacement is also checked (so the range is effectivly a cube rather than a sphere). (( **Note:** When isSquare is true, the search will also not use the unit's exact position to see if they are in range, but rather their hitbox (footprint & height). If any part of the hitbox crosses into the square, it will be selected.)) | ||
| + | ? is3D: | ||
| + | : a boolean. It determines if a true 3d distance is used for range, or if only the X and Z components (2D) distance calculation is used. | ||
| + | ? requireLOS: | ||
| + | : a boolean indicating if terrain line of sight is required. | ||
| + | ? enemyState: | ||
| + | : an int (either 0,1,2). | ||
| + | ? 0 = | ||
| + | : ignore enemy status. | ||
| + | ? 1 = | ||
| + | : Only find units that are enemies. | ||
| + | ? 2 = | ||
| + | : Only find units that are not enemies. | ||
| + | ? builtState: | ||
| + | : an int (either 0,1,2). | ||
| + | ? 0 = | ||
| + | : ignore built state. | ||
| + | ? 1 = | ||
| + | : Only find units that are built. | ||
| + | ? 2 = | ||
| + | : Only find units that are not built. | ||
| + | ? imperviousState: | ||
| + | : an int (either 0,1,2). | ||
| + | ? 0 = | ||
| + | : ignore impervious state. | ||
| + | ? 1 = | ||
| + | : Only find units that are not impervious. | ||
| + | ? 2 = | ||
| + | : Only find units that are impervious. Things like ore deposits are impervious. | ||
| ===== Examples ===== | ===== Examples ===== | ||
| Line 35: | Line 66: | ||
| === See Also === | === See Also === | ||
| - | * [[4rpl: | + | * [[GetUnits]] |
| | | ||
| < | < | ||