~~NOTOC~~
<=[[4rpl:start| Index]]
* [[4rpl:commands:getfieldcell|Get]]
* [[4rpl:commands:setfieldcell|Set]]
:!: Available in version 1.3 and later.
====== SetFieldCell ======
SetFieldCell(<-cellX <-cellZ <-AC <-fieldValue)
===== Description =====
Sets the field cell as the specified location. If 'AC' is true, then the AC affecting fields will be altered. If false, then the creeper affecting field will be altered. The fieldValue is a V2 in non normalized form (so it has high values, like 1000000 in it).
**Fields are reset on map load, so any fields must be recreated in the [[func_awake|:awake]] method.**
This method will **set** the field on the specified cell to a certain value. That means if there already was a field underneath, its effect will be erased. If you're not careful, you will erase the effect of nearby shields, singularity or other custom fields with this. This is something you should never allow to happen, as shields/singularity/custom fields will attempt to add a field of opposite force to erase their effect when they are no longer working, which will create an opposite field in the area that was previously reset with [[SetFieldCell]].
In order to add to a field rather than set it, retrieve its current values first using [[GetFieldCell]], add to those values, then set those values as the new field. To erase the new field, do the same thing, but instead subtract what was previously added. Alternatively, you can use [[SetFieldRect]], which adds fields rather than sets them.
For reference:\\
Shields have a field (total "strength") of 2000 throughout its radius.
===== Examples =====
:Awake
SetFieldCell(50 40 false V2(1000000 1000000))
<=[[4rpl:start| Index]]