diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 55529c3..b27650e 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "February 23, 2017"; + a3_DMS_version = "February 25, 2017"; requiredVersion = 1.66; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index 117286f..15d7475 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -7,7 +7,7 @@ [ _group, // GROUP: Group the AI will belong to _pos, // ARRAY (positionATL): Position of AI - _class, // STRING: Classname: "random","assault","MG", or "sniper". Use "custom" to use "_customGearSet" + _class, // STRING: Classname: "random","assault","MG", or "sniper". _difficulty, // STRING: Difficulty: "random","static","hardcore","difficult","moderate", or "easy" _side, // STRING: "bandit" only by default _type, // STRING: Type of AI: "soldier","static","vehicle","heli", etc. @@ -101,19 +101,6 @@ removeUniform _unit; removeVest _unit; removeBackpackGlobal _unit; -// Give 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; - if (_class in DMS_ai_SupportedRandomClasses) then { @@ -137,14 +124,22 @@ switch (DMS_AI_NamingType) do }; -if !(_class in DMS_ai_SupportedClasses) exitWith -{ - diag_log format ["DMS ERROR :: DMS_SpawnAISoldier called with unsupported _class: %1 | _this: %2",_class,_this]; - deleteVehicle _unit; -}; - if (_customGearSet isEqualTo []) then { + // Make sure the "_class" is supported. This check is moved here to maintain backwards compatibility. + if !(_class in DMS_ai_SupportedClasses) exitWith + { + diag_log format ["DMS ERROR :: DMS_SpawnAISoldier called with unsupported _class: %1 | _this: %2",_class,_this]; + }; + + + // Add Clothes first to make sure the unit can store everything... + _unit addHeadgear (selectRandom (missionNamespace getVariable [format ["DMS_%1_helmets",_class],DMS_assault_helmets])); + _unit forceAddUniform (selectRandom (missionNamespace getVariable [format ["DMS_%1_clothes",_class],DMS_assault_clothes])); + _unit addVest (selectRandom (missionNamespace getVariable [format ["DMS_%1_vests",_class],DMS_assault_vests])); + _unit addBackpackGlobal (selectRandom (missionNamespace getVariable [format ["DMS_%1_backpacks",_class],DMS_assault_backpacks])); + + // Equipment (Stuff that goes in the toolbelt slots) { if (_x in ["Binocular","Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03"]) then @@ -158,12 +153,6 @@ if (_customGearSet isEqualTo []) then } forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_class],[]]); - // Clothes - _unit addHeadgear (selectRandom (missionNamespace getVariable [format ["DMS_%1_helmets",_class],DMS_assault_helmets])); - _unit forceAddUniform (selectRandom (missionNamespace getVariable [format ["DMS_%1_clothes",_class],DMS_assault_clothes])); - _unit addVest (selectRandom (missionNamespace getVariable [format ["DMS_%1_vests",_class],DMS_assault_vests])); - _unit addBackpackGlobal (selectRandom (missionNamespace getVariable [format ["DMS_%1_backpacks",_class],DMS_assault_backpacks])); - // Random items that can be added to the unit's inventory, such as food, meds, etc. private _randItemCount = missionNamespace getVariable [format ["DMS_%1_RandItemCount",_class],0]; @@ -399,14 +388,27 @@ else ] call ExileServer_system_thread_addTask; }; +// Give default items { - _unit setSkill _x; -} forEach (missionNamespace getVariable [format["DMS_ai_skill_%1",_difficulty],[]]); + // "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; + + // Soldier killed event handler _unit addMPEventHandler ["MPKilled",'if (isServer) then {_this call DMS_fnc_OnKilled;};']; + + // Remove ramming damage from players. // Will not work if unit is not local (offloaded) if (DMS_ai_disable_ramming_damage) then @@ -427,6 +429,11 @@ if (DMS_ai_disable_ramming_damage) then }; +// Tweak difficulty stuff. +{ + _unit setSkill _x; +} forEach (missionNamespace getVariable [format["DMS_ai_skill_%1",_difficulty],[]]); + if (_difficulty == "hardcore") then { // Make him a little bit harder ;) @@ -445,6 +452,7 @@ _unit setCustomAimCoef (missionNamespace getVariable [format["DMS_AI_AimCoef_%1" _unit enableStamina (missionNamespace getVariable [format["DMS_AI_EnableStamina_%1",_difficulty], true]); + if (_type=="Soldier") then { _unit setVariable ["DMS_AISpawnPos",_pos]; @@ -458,6 +466,7 @@ if (_type == "Paratroopers") then _unit addBackpackGlobal "B_Parachute"; }; + // Set info variables _unit setVariable ["DMS_AISpawnTime", time]; _unit setVariable ["DMS_AI_Side", _side]; diff --git a/README.md b/README.md index 974e096..8faa41e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![ArmA 1.62](https://img.shields.io/badge/Arma-1.62-blue.svg) ![Exile 1.0.0 Potato](https://img.shields.io/badge/Exile-1.0.1%20Sweet Potato-C72651.svg) ![DMS Version](https://img.shields.io/badge/DMS%20Version-2016--09--05-blue.svg) ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) +![ArmA 1.66](https://img.shields.io/badge/Arma-1.66-blue.svg) ![Exile 1.0.2 "Kohlrabi"](https://img.shields.io/badge/Exile-1.0.2%20Kohlrabi-C72651.svg) ![DMS Version](https://img.shields.io/badge/DMS%20Version-2017--02--25-blue.svg) # To the User: