Example Code: Remove NVGs From Enemies: Difference between revisions
Category: Example Code
Lou Montana (talk | contribs) m (Some wiki formatting)  | 
				Lou Montana (talk | contribs)  m (Some wiki formatting)  | 
				||
| 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 |  | ||
Revision as of 18:50, 2 April 2022
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