TAW_Yonose 11 Posted October 11, 2014 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
jshock 513 Posted October 11, 2014 { if (side _x == EAST) then { //add flashlight }; } forEach allUnits; Share this post Link to post Share on other sites
XOSPECTRE 40 Posted October 11, 2014 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
jshock 513 Posted October 11, 2014 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
Beerkan 71 Posted October 11, 2014 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
TAW_Yonose 11 Posted October 11, 2014 works great as always Beerkan! Share this post Link to post Share on other sites
TAW_Yonose 11 Posted October 25, 2014 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
Beerkan 71 Posted October 25, 2014 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