- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#terrain_and_wall_commands|Terrain and Wall Commands]]
===== SetWall =====
^Arguments^Result^Notation^
|X, Y, Amt(0-1)| |''x1 y1 b1 -- ''|
=== Description ===
Sets wall values at specified coordinates.
The amount must be in the range of 0 to 1 where 0 means no wall, and 1 means a full health wall.
=== 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,Y1(32,32) and the second corner at X2,Y2(64, 64). As these values are [[crpl:docs:define|Input Variables]], you can change them in the editor.
$wallX1:32
$wallY1:32
$wallX2:64
$wallY2:64
GetTimer0 eq0 if
270 SetTimer0
<-wallY2 <-wallY1 do
<-wallX2 <-wallX1 do
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 (invincible) walls.
GetTimer0 eq0 if
270 SetTimer0
CurrentX ->x
CurrentY ->y
Self CONST_CELLWIDTH GetUnitAttribute ->cellWidth
Self CONST_CELLHEIGHT GetUnitAttribute ->cellHeight
<-cellWidth 2 div ->cellWidthRadius
<-cellHeight 2 div ->cellHeightRadius
<-y <-cellHeightRadius add 1 add <-y <-cellHeightRadius sub do
<-x <-cellWidthRadius add 1 add <-x <-cellWidthRadius sub do
I J 1 SetWall
loop
loop
endif