User Tools

Site Tools


4rpl:commands:setfieldrect

This is an old revision of the document!


Index

SetFieldRect

SetFieldRect(<-cellX <-cellZ <-fieldRect <-rectWidth <-strength <-direction <-affected <-deploy)

Description

Sets the field cells as defined by the fieldRect.

  • cellX: The X position to deploy the field rect. The center of the field rect will be at this position.
  • cellZ: The Z position to deploy the field rect. The center of the field rect will be at this position.
  • fieldRect: A list containing vectors that describe the field direction at each cell in the rectangle. Values are treated as normalized values in the range of -1 to 1. Each

vector in the list specifies the X and Z directions of the field via the first and SECOND elements of the supplied vectors.

  • rectWidth: The width of the rectangle that the fieldRect contains the data for. The height of the rectangle is determined by taking the fieldRect length and dividing it by the rectWidth.
  • strength: The strength is multiplied by the normalized value in the fieldRect to determine the actual value writting to the game's field array.
  • direction: A fieldREct is specified in a direction that can be thought of as pointing to the right (the positive X direction). The direction parameter can be 0,1,2,3. O leaves the

fieldRect unmodified. 1 will cause the field to be deployed as if the fieldRect was rotated 90 degrees counterclockwise. 2 as if it was rotated 180 degrees, and 3 as if 270 degrees.

  • affected: 0 means the field applies to both creeper and AC. 1 means creeper only, and 2 means AC only.
  • deploy: If true then values are written to the game's field array. IF false, then negative values are written to the game's field array. Useful for exactly reversing a deployed field.

Examples

CreateList ->field
V2(1 0) ->v
do (21 0)
   do(101 0)
      AppendToList(<-field <-v)
   loop
loop
SetFieldRect(119 86 <-field 101 1000000 0 0 true)

Index

4rpl/commands/setfieldrect.1610121708.txt.gz · Last modified: 2025/02/14 14:56 (external edit)