This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| prpl:setfieldcell [2016/12/02 23:34] – external edit 127.0.0.1 | prpl:setfieldcell [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ^Arguments^Result^Notation^ | ^Arguments^Result^Notation^ | ||
| - | | | | [ - ] | | + | | X, Y, VectorUp, VectorRight |
| === Description === | === 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 === | === Examples === | ||
| - | < | + | Spawn a weak field that points right at coordinates 5,5. |
| - | f1 = GetFloatFromStack(); | + | < |
| - | i2 = GetIntFromStack(); | + | 5 5 0.0 1.0 SetFieldCell |
| - | i1 = GetIntFromStack(); | + | </code> |
| - | + | ||
| + | Spawn some fields in a radius under a unit. | ||
| + | < | ||
| + | $RadiusX: | ||
| + | $RadiusY: | ||
| + | $Power: | ||
| + | $AngleDegrees: | ||
| + | |||
| + | once | ||
| + | #Convert angle in degrees to angle in radians | ||
| + | < | ||
| + | |||
| + | #Get the directional vector of the angle. | ||
| + | < | ||
| + | < | ||
| + | |||
| + | #Multiply the directional vector by power to increase the strength of the field. | ||
| + | < | ||
| + | < | ||
| + | |||
| + | #Spawn the fields in a radius relative to the center of the unit. | ||
| + | CurrentCoords ->Y ->X | ||
| + | <-Y < | ||
| + | <-X < | ||
| + | I J < | ||
| + | loop | ||
| + | loop | ||
| + | endonce | ||
| </ | </ | ||