This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| crpl:docs:setwall [2014/04/11 03:36] – added an example Eppiox | crpl:docs:setwall [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ~~DISCUSSION~~ | + | |
| <- [[crpl: | <- [[crpl: | ||
| ===== SetWall | ===== SetWall | ||
| Line 11: | Line 11: | ||
| The amount must be in the range of 0 to 1 where 0 means no wall, and 1 means a full health wall. | The amount must be in the range of 0 to 1 where 0 means no wall, and 1 means a full health wall. | ||
| === Examples === | === Examples === | ||
| + | Create a rectangle of permanent walls that can't ever be destroyed by Creeper, by repairing them every 9 seconds. | ||
| + | |||
| + | This example will create a square of walls, with the first corner being at X1, | ||
| < | < | ||
| - | #Lets you make a wall at x,y coords you can define on the CORE with full hp | + | $wallX1:32 |
| - | $wallX:0 | + | $wallY1:32 |
| - | $wallY:0 | + | $wallX2:64 |
| - | SetWall(< | + | $wallY2: |
| + | |||
| + | GetTimer0 eq0 if | ||
| + | 270 SetTimer0 | ||
| + | |||
| + | < | ||
| + | < | ||
| + | I J 1 SetWall | ||
| + | loop | ||
| + | loop | ||
| + | endif | ||
| + | </ | ||
| + | |||
| + | Spawn walls under this unit based on its cell width and cell height. Repair these walls every 9 seconds, effectively making them Crazonium | ||
| + | <code> | ||
| + | GetTimer0 eq0 if | ||
| + | 270 SetTimer0 | ||
| + | |||
| + | CurrentX | ||
| + | CurrentY ->y | ||
| + | |||
| + | Self CONST_CELLWIDTH GetUnitAttribute -> | ||
| + | Self CONST_CELLHEIGHT GetUnitAttribute -> | ||
| + | |||
| + | <-cellWidth 2 div -> | ||
| + | < | ||
| + | |||
| + | <-y < | ||
| + | <-x < | ||
| + | I J 1 SetWall | ||
| + | loop | ||
| + | loop | ||
| + | endif | ||
| </ | </ | ||