Example Code: Remove NVGs From Enemies: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
m (Some wiki formatting)
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{ArgTitle|2|{{arma3}}|{{GVI|arma3|2.02}}}}
{{Feature | Informative |
* [[units]] ''side'' has been introduced in {{GVI|arma3|2.02}}
}}
<sqf>
{
_x unlinkItem hmd _x; // removal of each unit's hmd
} forEach units opfor; // code is to be executed for each enemy
</sqf>
{{ArgTitle|2|{{arma3}}|{{GVI|arma3|1.56}}}}
{{ArgTitle|2|{{arma3}}|{{GVI|arma3|1.56}}}}
{{Feature | Informative |
{{Feature | Informative |
* [[opfor]] has been introduced in {{GVI|arma3|0.50}}
* [[opfor]] has been introduced in {{GVI|arma3|0.50}}
* {{ic|array [[select]] code}} has been introduced in {{GVI|arma3|1.56}}
* <sqf inline>_array select _code</sqf> has been introduced in {{GVI|arma3|1.56}}
}}
}}


Line 51: Line 63:
{{ArgTitle|2|{{ofp}}|{{GVI|ofp|1.00}}}}
{{ArgTitle|2|{{ofp}}|{{GVI|ofp|1.00}}}}
{{Feature | Informative | This is an [[SQS Syntax]] example.}}
{{Feature | Informative | This is an [[SQS Syntax]] example.}}
{{cc|remove its NVG for each provided '''enemy''' units}}
<sqs>
"[[Magic Variables#x|_x]] [[removeWeapon]] ""NVGoggles""" [[forEach]] ''_enemyUnitsArray''
; remove its NVG for each provided enemy units
"_x removeWeapon ""NVGoggles""" forEach _enemyUnitsArray
</sqs>




[[Category: Example Code]]
[[Category: Example Code]]

Revision as of 18:03, 25 July 2022

Arma 3

{ _x unlinkItem hmd _x; // removal of each unit's hmd } forEach units opfor; // code is to be executed for each enemy


Arma 3

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

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

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

This is an SQS Syntax example.

; remove its NVG for each provided enemy units "_x removeWeapon ""NVGoggles""" forEach _enemyUnitsArray