Example Code: Remove NVGs From Enemies: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "{{arma}}" to "{{arma1}}") |
Lou Montana (talk | contribs) m (Text replacement - "{{Feature | Informative | " to "{{Feature|informative|") |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ArgTitle|{{arma3}}|2|{{GVI|arma3|1. | {{ArgTitle|2|{{arma3}}|{{GVI|arma3|2.02}}}} | ||
{{Informative | | {{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}}}} | |||
{{Feature | Informative | | |||
* [[opfor]] has been introduced in {{GVI|arma3|0.50}} | * [[opfor]] has been introduced in {{GVI|arma3|0.50}} | ||
* | * <sqf inline>_array select _code</sqf> has been introduced in {{GVI|arma3|1.56}} | ||
}} | }} | ||
<sqf> | |||
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 | |||
</sqf> | |||
{{ArgTitle|{{arma2}} | {{ArgTitle|2|{{arma2}}|{{GVI|arma2|1.00}}}} | ||
{{Informative | | {{Feature | Informative | | ||
* [[allUnits]] has been introduced in {{GVI|arma2|1.00}} | * [[allUnits]] has been introduced in {{GVI|arma2|1.00}} | ||
}} | }} | ||
<sqf> | |||
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 | |||
</sqf> | |||
{{ArgTitle|{{arma1}} / {{ofpr}} | {{ArgTitle|2|{{arma1}} / {{ofpr}}|{{GVI|arma1|1.00}} {{GVI|ofpr|1.85}}}} | ||
{{Informative | | {{Feature | Informative | | ||
* [[SQF | * [[SQF Syntax]] has been introduced in {{GVI|ofpr|1.85}} | ||
}} | }} | ||
<sqf> | |||
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 | |||
</sqf> | |||
{{ArgTitle|{{ofp}} | {{ArgTitle|2|{{ofp}}|{{GVI|ofp|1.00}}}} | ||
{{ | {{Feature|informative|This is an [[SQS Syntax]] example.}} | ||
<sqs> | |||
; remove its NVG for each provided enemy units | |||
"_x removeWeapon ""NVGoggles""" forEach _enemyUnitsArray | |||
</sqs> | |||
[[Category: Example Code]] | [[Category: Example Code]] |
Latest revision as of 21:42, 16 May 2024
Arma 3
Arma 3
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
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
; remove its NVG for each provided enemy units
"_x removeWeapon ""NVGoggles""" forEach _enemyUnitsArray