Example Code: Remove NVGs From Enemies
Topic · Markdown · JSON · original wiki page
Arma 3 (Arma 3 v2.02)
Note
- units side has been introduced in Arma 3 v2.02
{
_x unlinkItem hmd _x; // removal of each unit's hmd
} forEach units opfor; // code is to be executed for each enemy
Arma 3 (Arma 3 v1.56)
Note
- opfor has been introduced in Arma 3 v0.50
_array select _codehas been introduced in Arma 3 v1.56
private _enemySide = opfor; // definition of the enemy side
private _enemies = allUnits select { side _x == _enemySide; }; // selection of all enemy units from allUnits
{
_x unlinkItem hmd _x; // removal of each unit's hmd
} forEach _enemies; // code is to be executed for each enemy
Arma 2 (Arma 2 v1.00)
Note
- allUnits has been introduced in Arma 2 v1.00
private "_enemySide"; // private definition of the _enemySide variable
_enemySide = east; // value attribution to _enemySide
{
if (side _x == _enemySide) then // if the unit is on the _enemySide, process the next step
{
_x removeWeapon "NVGoggles"; // removal of the enemy unit's NVG
}
} forEach allUnits; // going through -all- units
Armed Assault / Operation Flashpoint: Resistance (Armed Assault v1.00 Operation Flashpoint: Resistance v1.85)
Note
- SQF Syntax has been introduced in Operation Flashpoint: Resistance v1.85
private "_enemySide"; // private definition of the _enemySide variable
_enemySide = east; // value attribution to _enemySide
{
if (side _x == _enemySide) then // if the unit is on the _enemySide, process the next step
{
_x removeWeapon "NVGoggles"; // removal of the enemy unit's NVG
}
} forEach _unitsArray; // going through provided units - allUnits has been introduced in Arma 2
Operation Flashpoint (Operation Flashpoint v1.00)
Note
This is an SQS Syntax example.
; remove its NVG for each provided enemy units
"_x removeWeapon ""NVGoggles""" forEach _enemyUnitsArray