<- [[.:prplreference| PRPL reference]] <- [[.:prplreference#everything_else_2|Everything Else 2]] ===== SETFIELDCELL ===== ^Arguments^Result^Notation^ | X, Y, VectorUp, VectorRight | | [ x1 y1 n1 n2 - ] | === Description === Assigns a directional field on a specified cell. Only one field can exist on a cell - changing a field again will fully override the previous field. VectorUp and VectorRight control the direction of the field. For example, values of: * 1 1 will create a field that points in the upper right. * 1 0 will create a field that points up. * -5 0 will create a stronger field that points down. === Examples === Spawn a weak field that points right at coordinates 5,5. 5 5 0.0 1.0 SetFieldCell Spawn some fields in a radius under a unit. $RadiusX:4 $RadiusY:4 $Power:5.0 $AngleDegrees:45 once #Convert angle in degrees to angle in radians <-AngleDegrees PI mul 180 div ->AngleRadians #Get the directional vector of the angle. <-AngleRadians sin ->DirectionY <-AngleRadians cos ->DirectionX #Multiply the directional vector by power to increase the strength of the field. <-DirectionY <-Power mul ->VectorUp <-DirectionX <-Power mul ->VectorRight #Spawn the fields in a radius relative to the center of the unit. CurrentCoords ->Y ->X <-Y <-RadiusY add 1 add <-Y <-RadiusY sub do <-X <-RadiusX add 1 add <-X <-RadiusX sub do I J <-VectorUp <-VectorRight SetFieldCell loop loop endonce