Example Code: Remove NVGs From Enemies: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|arma|" to "|arma1|")
m (Text replacement - "\{\{( *)Informative( *)\|" to "{{$1Feature$2|$2Informative$2|")
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{ArgTitle|{{arma3}}|2|{{GVI|arma3|1.55}}}}
{{ArgTitle|{{arma3}}|2|{{GVI|arma3|1.55}}}}
{{Informative |
{{Feature | Informative |
* [[opfor]] has been introduced in {{GVI|arma3|0.50}}
* [[opfor]] has been introduced in {{GVI|arma3|0.50}}
* {{Inline code|array [[select]] code}} has been introduced in {{GVI|arma3|1.55}}
* {{Inline code|array [[select]] code}} has been introduced in {{GVI|arma3|1.55}}
Line 14: Line 14:


{{ArgTitle|{{arma2}}|2|{{GVI|arma2|1.00}}}}
{{ArgTitle|{{arma2}}|2|{{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}}
}}
}}
Line 29: Line 29:


{{ArgTitle|{{arma1}} / {{ofpr}}|2|{{GVI|arma1|1.00}} {{GVI|ofpr|1.85}}}}
{{ArgTitle|{{arma1}} / {{ofpr}}|2|{{GVI|arma1|1.00}} {{GVI|ofpr|1.85}}}}
{{Informative |
{{Feature | Informative |
* [[SQF syntax]] has been introduced in {{GVI|ofpr|1.85}}
* [[SQF syntax]] has been introduced in {{GVI|ofpr|1.85}}
}}
}}
Line 43: Line 43:


{{ArgTitle|{{ofp}}|2|{{GVI|ofp|1.00}}}}
{{ArgTitle|{{ofp}}|2|{{GVI|ofp|1.00}}}}
{{Informative | This is an [[SQS syntax]] example.}}
{{Feature | Informative | This is an [[SQS syntax]] example.}}
  {{cc|remove its NVG for each provided '''enemy''' units}}
  {{cc|remove its NVG for each provided '''enemy''' units}}
  "[[_x]] [[removeWeapon]] ""NVGoggles""" [[forEach]] ''_enemyUnitsArray''
  "[[_x]] [[removeWeapon]] ""NVGoggles""" [[forEach]] ''_enemyUnitsArray''

Revision as of 01:03, 7 February 2021

2

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


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


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 _unitsArray;					// going through provided units - allUnits has been introduced in Arma 2


2

This is an SQS syntax example.
// remove its NVG for each provided enemy units
"_x removeWeapon ""NVGoggles""" forEach _enemyUnitsArray