Jump to content
TAW_Yonose

Adding flashlight to enemy

Recommended Posts

Hello

How do i add flashlight to all enemy without having to add the code to every single unit?

Share this post


Link to post
Share on other sites

{

if (side _x == EAST) then {

//add flashlight

};

} forEach allUnits;

Share this post


Link to post
Share on other sites

will be this works too ?? or i need differnt script ?

{

if (vehicle _x == vehicle name) then {

//add action "action","action.sqf"

};

} forEach allUnits;

Share this post


Link to post
Share on other sites
will be this works too ?? or i need differnt script ?

{

if (vehicle _x == vehicle name) then {

//add action "action","action.sqf"

};

} forEach allUnits;

Yes that could work.

Share this post


Link to post
Share on other sites

THIS is how to add Flashlights to AI Units. First it removes NV Goggles. Then it removes laser pointers. Then it adds flashlights, forces flashlight on and sets AI spot distance to low.
Also script ONLY does this if it's night time AND only if unit is a man.

Stick this in your init.sqf

[] execVM "addflash.sqf";

addflash.sqf

if (!isServer) exitWith {};
// filter for only East units,
// {if (side _x isEqualTo EAST) then
// You could filter using alternative methods, eg IsKindof "Man" etc. In this instance filter for all units not on players side.
// Remove NV GOGGLES based on Side

{if (_x IsKindof "Man" &&  (side _x != playerSide))
	then {
		_x unlinkItem hmd _x;
		 };

//Now add Flashlight only if it"s night..
_GiveFlashlight = sunOrMoon;
if (_GiveFlashlight < 1)
then {
	_x unassignItem "acc_pointer_IR";
	_x removePrimaryWeaponItem "acc_pointer_IR";
	_x addPrimaryWeaponItem "acc_flashlight";
	_x assignItem "acc_flashlight";
	_x enableGunLights "ForceOn";
	_x setskill ["spotDistance",(0 + random 0.2)];// Reduced for night time
	_x setskill ["spotTime",(0 + random 0.2)];// ditto
	};
} forEach allUnits;
 

Share this post


Link to post
Share on other sites

Can you make it possible to use for INDEP units too?

It dosent work with INDEP it seems..

Share this post


Link to post
Share on other sites
TAW_Yonose said:
Can you make it possible to use for INDEP units too?

It dosent work with INDEP it seems..

For independant use:-

if (!isServer) exitWith {};
// filter for only East units,
// {if (side _x isEqualTo EAST) then
// You could filter using alternative methods, eg IsKindof "Man" etc. In this instance filter for all units not on players side.
// Remove NV GOGGLES based on Side

{if (_x IsKindof "Man" &&  (side _x != playerSide))
	then {
		_x unlinkItem hmd _x;
		};

//Now add Flashlight only if it"s night..
_GiveFlashlight = sunOrMoon;
if (_GiveFlashlight < 1)
then {
	_x unassignItem "acc_pointer_IR";
	_x removePrimaryWeaponItem "acc_pointer_IR";
	_x addPrimaryWeaponItem "acc_flashlight";
	_x assignItem "acc_flashlight";
	_x enableGunLights "ForceOn";
	_x setskill ["spotDistance",(0 + random 0.2)];// Reduced for night time
	_x setskill ["spotTime",(0 + random 0.2)];// ditto
	};
} forEach allUnits;
 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×