From a29824e3718569b08a953642c016c3ec311a6417 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 4 Sep 2015 22:59:27 -0500 Subject: [PATCH] Fixed binocs/rangefinder BS on AI --- .../a3_dms/scripts/fn_SpawnAISoldier.sqf | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index 18db430..807b9ef 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -79,7 +79,17 @@ removeGoggles _unit; // Give default items if !(DMS_ai_default_items isEqualTo []) then { - {_unit linkItem _x;} forEach DMS_ai_default_items; + { + // "Why doesn't linkItem work with any of these? Because fuck you, that's why" - BIS + if (_x in ["Binocular","Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03"]) then + { + _unit addWeapon _x; + } + else + { + _unit linkItem _x; + }; + } forEach DMS_ai_default_items; }; @@ -97,10 +107,21 @@ if (!_useCustomGear) then if !(_type in DMS_ai_SupportedClasses) exitWith { diag_log format ["DMS ERROR :: DMS_SpawnAISoldier called with unsupported _type: %1 | _this: %2",_type,_this]; - };// No more idiot-proofing for the following configs + }; + // Equipment (Stuff that goes in the toolbelt slots) - {_unit linkItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_type],[]]); + { + if (_x in ["Binocular","Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03"]) then + { + _unit addWeapon _x; + } + else + { + _unit linkItem _x; + }; + } forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_type],[]]); + // Items (Loot stuff that goes in uniform/vest/backpack) {_unit addItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_items",_type],[]]);