[Snippet] Equipping AI with flashlights / forcing them on

Party-approved future science plus handbooks for the revolution
Post Reply
User avatar
Posts: 1208
Joined: Wed May 25, 2011 4:59 pm

[Snippet] Equipping AI with flashlights / forcing them on

Post by wolfenswan » Wed Jul 16, 2014 1:17 pm

Removes NVGs from AI and gives them flashlights which they'll use in engagements/when aware.

Put this in the init.sqf and/or AFTER any spawn script you might be running.

Code: Select all

	private ["_unit"];
		_unit = _x;

		// Only run where the unit is local, it isn't a player and doesn't have a flashlight
		if (local _unit && !isplayer _unit && !("acc_flashlight" in primaryWeaponItems _unit)) then {

		// Remove laser if equipped
		if ("acc_pointer_IR" in primaryWeaponItems _unit) then {_x removePrimaryWeaponItem "acc_pointer_IR"};
		_unit addPrimaryWeaponItem "acc_flashlight";	// Add flashlight

			// Removes NVGs from unit
				if (_x in assigneditems _unit) exitWith {_unit unlinkItem _x};
			} forEach ["NVGoggles_OPFOR","NVGoggles_INDEP","NVGoggles"];

		// Forces flashlights on
	    // _unit enablegunlights "forceOn";
} forEach allUnits;

Post Reply