From fd94fb0bcc0d8568e0c36b36d52ed09ff99e797f Mon Sep 17 00:00:00 2001 From: eraser1 Date: Thu, 14 Apr 2016 21:20:26 -0500 Subject: [PATCH 1/6] Release Candidate --- @ExileServer/addons/a3_dms/config.cpp | 2 +- .../a3_dms/missions/static/saltflats.sqf | 2 +- .../a3_dms/scripts/fn_AddMissionToMonitor.sqf | 7 +--- .../scripts/fn_AddMissionToMonitor_Static.sqf | 8 ++-- .../a3_dms/scripts/fn_CleanUpManager.sqf | 5 +-- .../addons/a3_dms/scripts/fn_GetAllUnits.sqf | 4 +- .../scripts/fn_GroupReinforcementsManager.sqf | 34 +++++++++++----- .../scripts/fn_HeliParatroopers_Monitor.sqf | 39 +++++++++---------- .../scripts/fn_MissionsMonitor_Dynamic.sqf | 16 +++----- .../scripts/fn_MissionsMonitor_Static.sqf | 16 +++----- .../addons/a3_dms/scripts/fn_OnKilled.sqf | 20 ++++------ .../a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf | 5 +++ .../a3_dms/scripts/fn_SpawnAISoldier.sqf | 21 +++++----- .../scripts/fn_SpawnHeliReinforcement.sqf | 28 ++++++++----- README.md | 11 +++++- 15 files changed, 115 insertions(+), 103 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index d28c2e6..5bc43a9 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 = "March 31 2016 (TEST)"; + a3_DMS_version = "April 14, 2016 (RC)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/missions/static/saltflats.sqf b/@ExileServer/addons/a3_dms/missions/static/saltflats.sqf index 4029a49..82794f8 100644 --- a/@ExileServer/addons/a3_dms/missions/static/saltflats.sqf +++ b/@ExileServer/addons/a3_dms/missions/static/saltflats.sqf @@ -105,7 +105,7 @@ _crate = [_crateClassname, _pos] call DMS_fnc_SpawnCrate; _veh = [ [ - _pos getPos [_pos,100,random 360], + _pos getPos [100,random 360], _pos ], _group, diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf index 920f0f6..c096469 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf @@ -57,7 +57,7 @@ */ -private ["_added", "_pos", "_onEndingScripts", "_completionInfo", "_timeOutInfo", "_units", "_inputUnits", "_missionObjs", "_mines", "_difficulty", "_side", "_messages", "_markers", "_arr", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_missionName", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_missionEvents", "_onSuccessScripts", "_onFailScripts"]; +private ["_added", "_pos", "_onEndingScripts", "_completionInfo", "_timeOutInfo", "_units", "_missionObjs", "_mines", "_difficulty", "_side", "_messages", "_markers", "_arr", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_missionName", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_missionEvents", "_onSuccessScripts", "_onFailScripts"]; _added = false; @@ -68,7 +68,7 @@ if !(params ["_pos","",[[]],[2,3]], ["_completionInfo","",[[]]], ["_timeOutInfo","",[[]],[1,2]], - ["_inputUnits","",[[]]], + ["_units","",[[]]], ["_missionObjs","",[[]],[3,4]], ["_messages","",[[]],[3]], ["_markers","",[[]],[DMS_MissionMarkerCount]], @@ -103,9 +103,6 @@ try ["_timeUntilFail",DMS_MissionTimeOut call DMS_fnc_SelectRandomVal,[0]] ]; - _units = _inputUnits call DMS_fnc_GetAllUnits; - - if !(_missionObjs params [ ["_buildings","",[[]]], diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf index cf407d8..c84f343 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf @@ -67,7 +67,7 @@ */ -private ["_added", "_pos", "_onEndingScripts", "_completionInfo", "_timeOutInfo", "_units", "_inputUnits", "_missionObjs", "_mines", "_difficulty", "_side", "_messages", "_markers", "_arr", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_missionName", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_missionEvents", "_onSuccessScripts", "_onFailScripts"]; +private ["_added", "_pos", "_onEndingScripts", "_completionInfo", "_timeOutInfo", "_units", "_missionObjs", "_mines", "_difficulty", "_side", "_messages", "_markers", "_arr", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_missionName", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_missionEvents", "_onSuccessScripts", "_onFailScripts"]; _added = false; @@ -78,7 +78,7 @@ if !(params ["_completionInfo","",[[]]], ["_groupReinforcementsInfo","",[[]]], ["_timeOutInfo","",[[]],[1,2]], - ["_inputUnits","",[[]]], + ["_units","",[[]]], ["_missionObjs","",[[]],[3,4]], ["_messages","",[[]],[3]], ["_markers","",[[]],[DMS_MissionMarkerCount]], @@ -166,7 +166,7 @@ try _timeStarted, _timeUntilFail ], - _inputUnits, + _units, [ _buildings, _vehs, @@ -195,7 +195,7 @@ try if (DMS_MarkerText_ShowAICount) then { _markerDot = _markers select 0; - _markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count (_inputUnits call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]); + _markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count (_units call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]); }; if (DMS_DEBUG) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf index 5ed2735..2e32e3a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf @@ -17,7 +17,6 @@ A single object can also be used for (_this select 0) */ -if (DMS_CleanUpList isEqualTo []) exitWith {}; // Empty array, no objects to clean :) { if (DMS_DEBUG) then @@ -27,7 +26,7 @@ if (DMS_CleanUpList isEqualTo []) exitWith {}; // Empty array, no objects to cl private ["_objs","_timeAddedToList","_timeUntilClean"]; - + if !(_x params [ ["_objs",[objNull],[objNull,[],grpNull]], @@ -51,4 +50,4 @@ if (DMS_CleanUpList isEqualTo []) exitWith {}; // Empty array, no objects to cl (format ["CleanUpManager :: %1 is not yet ready to clean!",_x]) call DMS_fnc_DebugLog; }; }; -} forEach DMS_CleanUpList; \ No newline at end of file +} forEach DMS_CleanUpList; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf index cbbfe6a..1f60919 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf @@ -40,8 +40,8 @@ _units = []; case "OBJECT": { [ - [_parameter], - [] + [], + [_parameter] ] select (alive _parameter); }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf index c7adfae..cdb832c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf @@ -96,9 +96,12 @@ _monitorParams = [ _AICount, // SCALAR: If the AI Group has fewer than "_AICount" living units, then the group will receive reinforcements. - _ejectFFVGunners, // BOOLEAN: Whether or not to eject the gunners that are FFV (firing from vehicle). - _remainAsGunship, // BOOLEAN: Whether or not the heli should remain in the area and function as a gunship or simply fly away and despawn. - _vehClass // (OPTIONAL) STRING: The classname of the vehicle to spawn. Use "random" to select a random vehicle from "DMS_ArmedVehicles". Default: "random" + _ejectFFVGunners, // BOOLEAN: Whether or not to eject Fire-From-Vehicle (FFV) gunners. + _maxJumpers, // SCALAR: Maximum number of AI to eject from the aircraft. Set to a really high # to ignore (like 999). + _remainAsGunship, // BOOLEAN: Whether or not to keep the heli flying around as a gunship. + _dropPoint, // OBJECT or ARRAY (OPTIONAL - Position2D or 3D): The location to drop the reinforcements at. The drop point will default to the group leader. + _heliClass, // STRING (OPTIONAL): The classname of the heli to spawn. + _spawnPos // ARRAY (OPTIONAL - Position2D or 3D): The position for the heli to spawn at. ] This reinforcement type will attempt to drop the AI off at the group leader's position. The heli will spawn in the air 500-5000 meters away from the leader's position and 1000 meters away from a player (default). @@ -504,7 +507,8 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the [ ["_AICount",0,[0]], ["_ejectFFVGunners",false,[false]], - ["_remainAsGunship",false,[false]] + ["_maxJumpers",0,[0]], + ["_remainAsGunship", 0, [false]] ]) exitWith { @@ -514,18 +518,28 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - private["_heli"]; + private _dropPoint = if ((count _monitorParams)>4) then {_monitorParams param [4, getPosATL (leader _AIGroup), [objNull,[]], [2,3]]} else {getPosATL (leader _AIGroup)}; + private _heliClass = if ((count _monitorParams)>5) then {_monitorParams param [5, "", [""]]} else {selectRandom DMS_ReinforcementHelis}; - _heli = - [ + private _params = + [ _AIGroup, _class, _difficulty, _side, - getPosATL (leader _AIGroup), + _dropPoint, _ejectFFVGunners, - _remainAsGunship - ] call DMS_fnc_SpawnHeliReinforcement; + _maxJumpers, + _remainAsGunship, + _heliClass + ]; + + if ((count _monitorParams)>6) then + { + _params pushBack (_monitorParams select 6); + }; + + private _heli = _params call DMS_fnc_SpawnHeliReinforcement; // Every vehicle counts as one unit given, so the number of units given is equivalent to number of waves given. _reinforcementWavesGiven = _reinforcementWavesGiven + 1; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf index f65eca6..a07ef5b 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf @@ -2,16 +2,12 @@ DMS_fnc_HeliParatroopers_Monitor Created by eraser1 - **********!!!!NOTE!!!!**********: THIS FUNCTION IS NOT FINAL, IT IS FOR TESTING PURPOSES ONLY! Changes are planned, and the function parameters will likely change. - In addition, this function is not behaving as expected. - Used in Exile's thread system. Every heli to be used as paratroopers has an index in "DMS_HeliParatrooper_Arr". Every index has the values: [ _heli, // OBJECT: The heli that holds the units. _dropPoint, // ARRAY (POSITION2D or 3D): The position (or object) to which the troopers need to be dropped near. - _ejectFFVGunners, // BOOLEAN: Whether or not to eject Fire-From-Vehicle (FFV) gunners. _remainAsGunship // BOOLEAN: Whether or not to keep the heli flying around as a gunship. ] @@ -46,14 +42,12 @@ } forEach DMS_HelisToClean; -if (DMS_HeliParatrooper_Arr isEqualTo []) exitWith {}; { if !(_x params [ ["_heli", objNull, [objNull]], ["_dropPoint", 0, [[], objNull], [2,3]], - ["_ejectFFVGunners", false, [false]], ["_remainAsGunship", false, [false]] ]) exitWith @@ -89,18 +83,11 @@ if (DMS_HeliParatrooper_Arr isEqualTo []) exitWith {}; }; { - _x params - [ - "_unit", - "_role", - "_cargoIndex", - "_turretPath", - "_personTurret" - ]; + private _unit = _x; - if ((alive _unit) && {(_role isEqualTo "cargo") || {_ejectFFVGunners && {_personTurret}}}) then + if ((alive _unit) && {_unit getVariable ["DMS_Paratrooper", false]}) then { -/* + /* moveOut _unit; private ["_parachute", "_dir"]; _parachute = createVehicle ["Steerable_Parachute_F", (getPosATL _unit), [], 0, "CAN_COLLIDE"]; @@ -108,13 +95,13 @@ if (DMS_HeliParatrooper_Arr isEqualTo []) exitWith {}; _parachute enableSimulationGlobal true; _unit moveInDriver _parachute; -*/ + */ _unit action ["Eject", _heli]; _unit setDestination [_dropPoint, "LEADER DIRECT", true]; _unit setVariable ["DMS_AISpawnPos", _dropPoint]; }; - } forEach (fullCrew _heli); + } forEach (crew _heli); if (_remainAsGunship) then { @@ -134,11 +121,21 @@ if (DMS_HeliParatrooper_Arr isEqualTo []) exitWith {}; else { private _pilot = driver _heli; + private _pilotGrp = createGroup (side _pilot); + private _newPos = _dropPoint getPos [2 * worldSize, random 360]; - [_pilot] joinSilent (createGroup (side _pilot)); + [_pilot] joinSilent _pilotGrp; - _pilot setDestination [_dropPoint getPos [2 * worldSize, random 360], "VEHICLE PLANNED", true]; - {_pilot disableAI _x} forEach ["FSM", "AUTOCOMBAT", "CHECKVISIBLE", "TARGET", "AUTOTARGET"]; + _pilot setDestination [_newPos, "VEHICLE PLANNED", true]; + + for "_i" from count (waypoints _pilotGrp) to 1 step -1 do + { + deleteWaypoint ((waypoints _pilotGrp) select _i); + }; + + private _wp = _pilotGrp addWaypoint [_newPos,5]; + _wp setWaypointType "MOVE"; + //{_pilot disableAI _x} forEach ["FSM", "AUTOCOMBAT", "CHECKVISIBLE", "TARGET", "AUTOTARGET"]; DMS_HelisToClean pushBack _heli; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf index e4856aa..f4f1034 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf @@ -33,7 +33,6 @@ A semi-full breakdown can be found in fn_AddMissionToMonitor.sqf */ -if (DMS_Mission_Arr isEqualTo []) exitWith {}; // Empty array, no missions running private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_buildings", "_vehs", "_crate_info_array", "_mines", "_missionName", "_msgWIN", "_msgLose", "_markers", "_missionSide", "_arr", "_cleanupList"]; @@ -228,16 +227,13 @@ private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_bui _dot setMarkerText (format ["%1 (%2 %3 remaining)",_text,count (_units call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]); }; - if !(_missionEvents isEqualTo []) then - { - /* - Coming soon... + /* + Coming soon... - { - _x call DMS_fnc_HandleMissionEvents; - } forEach _missionEvents; - */ - }; + { + _x call DMS_fnc_HandleMissionEvents; + } forEach _missionEvents; + */ if !(_onMonitorEnd isEqualTo {}) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf index d72674f..8cfc034 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf @@ -39,7 +39,6 @@ A semi-full breakdown can be found in fn_AddStaticMissionToMonitor.sqf */ -if (DMS_StaticMission_Arr isEqualTo []) exitWith {}; // Empty array, no static missions running { @@ -232,16 +231,13 @@ if (DMS_StaticMission_Arr isEqualTo []) exitWith {}; // Empty array, no stati _dot setMarkerText (format ["%1 (%2 %3 remaining)",_text,count (_inputAIUnits call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]); }; - if !(_missionEvents isEqualTo []) then - { - /* - Coming soon... + /* + Coming soon... - { - _x call DMS_fnc_HandleMissionEvents; - } forEach _missionEvents; - */ - }; + { + _x call DMS_fnc_HandleMissionEvents; + } forEach _missionEvents; + */ if (DMS_AllowStaticReinforcements) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf index 69f6dd3..42ec602 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf @@ -117,22 +117,16 @@ if (!isNull _av) then if (_memCount isEqualTo 0) then { /* - I know what you're probably thinking: - What the hell is this? An "if-statement" evaluated for an "if-statement"?! What madness is this?! Does this guy know what he's doing? There has to be a better way! - - To which I (eraser1) reply... - I know it looks funky, and there are prettier and slicker ways to do this (such as using "select") BUT I tested extensively and found out that this way is the fastest way, so... yeah... + This is some pretty funky code because this is about the fastest way to do the task. + An "if-statement" inside another "if-statement" is almost as fast, but it isn't as slick ;) */ if ( - if (_av isKindOf "StaticWeapon") then - { - DMS_AI_destroyStaticWeapon && {(random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyStaticWeapon_chance])} - } - else - { - (random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyVehicleChance]) - } + call + [ + { (random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyVehicleChance]) }, + { DMS_AI_destroyStaticWeapon && {(random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyStaticWeapon_chance])} } + ] select (_av isKindOf "StaticWeapon") ) then { _av setDamage 1; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf index 70a2be3..efa54d8 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf @@ -156,6 +156,8 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U (owner _playerObj) publicVariableClient "ExileClientPlayerScore"; ExileClientPlayerScore = nil; }; + + //DONKEYPUNCH CUSTOM KILL STAT ADD FOR AI KILL if (DMS_Add_AIKill2DB) then { @@ -167,6 +169,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U (owner _playerObj) publicVariableClient "ExileClientPlayerKills"; ExileClientPlayerKills = nil; }; + //DONKEYPUNCH CUSTOM KILL RANK CHANGE FOR AI KILL if (DMS_Enable_RankChange) then { @@ -180,6 +183,8 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U ExileClientPlayerHumanity = nil; }; }; + + if (DMS_DEBUG) then { format ["PlayerAwardOnAIKill :: %1 (%2) awarded %3 poptabs and %4 respect for killing %5. Player's money is now %6, and respect is now %7. Roadkill: %8", name _playerObj, _playerUID, _moneyChange, _repChange, _unit, _playerMoney, _playerRespect, _roadKilled] call DMS_fnc_DebugLog; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index 0df096a..e0c4fdb 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -106,20 +106,17 @@ removeVest _unit; removeBackpackGlobal _unit; // Give default items -if !(DMS_ai_default_items isEqualTo []) then { + // "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 { - // "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; -}; + _unit addWeapon _x; + } + else + { + _unit linkItem _x; + }; +} forEach DMS_ai_default_items; if (_class == "unarmed") then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf index 7f04694..563b996 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf @@ -2,8 +2,6 @@ DMS_fnc_SpawnHeliReinforcement Created by eraser1 - **********!!!!NOTE!!!!**********: THIS FUNCTION IS NOT FINAL, IT IS FOR TESTING PURPOSES ONLY! Changes are planned, and the function parameters will likely change. - This function will create a heli/aircraft within "DMS_RHeli_MinDistFromDrop" to "DMS_RHeli_MaxDistFromDrop" meters and drop units at "_dropPoint". Usage: @@ -14,6 +12,7 @@ _side, // STRING: The "side" that the AI are on. _dropPoint, // OBJECT or ARRAY (Position2D or 3D): The location to drop the reinforcements at. _ejectFFVGunners, // BOOLEAN: Whether or not to eject Fire-From-Vehicle (FFV) gunners. + _maxJumpers, // SCALAR: Maximum number of AI to eject from the aircraft. Set to a really high # to ignore (like 999). _remainAsGunship, // BOOLEAN: Whether or not to keep the heli flying around as a gunship. _heliClass, // STRING (OPTIONAL): The classname of the heli to spawn. _spawnPos // ARRAY (OPTIONAL - Position2D or 3D): The position for the heli to spawn at. @@ -33,6 +32,7 @@ if !(params ["_side", 0, [""]], ["_dropPoint", 0, [[],objNull], [2,3]], ["_ejectFFVGunners", 0, [false]], + ["_maxJumpers",0,[0]], ["_remainAsGunship", 0, [false]] ]) exitWith @@ -47,7 +47,7 @@ if (isNull _AIGroup) exitWith -1 }; -_heliClass = if ((count _this)>7) then {_this param [7, "", [""]]} else {selectRandom DMS_ReinforcementHelis}; +_heliClass = if ((count _this)>8) then {_this param [8, "", [""]]} else {selectRandom DMS_ReinforcementHelis}; // Make the AI group local to add passengers. if !(local _AIGroup) then @@ -58,9 +58,9 @@ if !(local _AIGroup) then // Get the spawn position for the heli _spawnPos = - if ((count _this)>8) then + if ((count _this)>9) then { - _this param [8, "", [[]], [2,3]] + _this param [9, [0,0,0], [[]], [2,3]] } else { @@ -122,9 +122,11 @@ _crewCount = case "gunner"; case "turret": { - if (_ejectFFVGunners && {_personTurret}) then + if (_ejectFFVGunners && {_personTurret} && {_paratrooperCount < _maxJumpers}) then { _unit = [_AIGroup,_spawnPos,_class,_difficulty,_side,"Paratroopers"] call DMS_fnc_SpawnAISoldier; + + _unit setVariable ["DMS_Paratrooper", true]; _paratrooperCount = _paratrooperCount + 1; } else @@ -132,14 +134,20 @@ _crewCount = _unit = [_AIGroup,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; _unit setVariable ["DMS_AssignedVeh",_heli]; }; + _unit moveInTurret [_heli, _x]; }; case "cargo": { - _unit = [_AIGroup,_spawnPos,_class,_difficulty,_side,"Paratroopers"] call DMS_fnc_SpawnAISoldier; - _unit moveInCargo [_heli, _cargoIndex]; - _paratrooperCount = _paratrooperCount + 1; + if (_paratrooperCount < _maxJumpers) then + { + _unit = [_AIGroup,_spawnPos,_class,_difficulty,_side,"Paratroopers"] call DMS_fnc_SpawnAISoldier; + _unit moveInCargo [_heli, _cargoIndex]; + + _unit setVariable ["DMS_Paratrooper", true]; + _paratrooperCount = _paratrooperCount + 1; + }; }; }; _units pushBack _unit; @@ -167,4 +175,4 @@ if (DMS_DEBUG) then }; // Add the necessary information to the monitor. -DMS_HeliParatrooper_Arr pushBack [_heli, _dropPoint, _ejectFFVGunners, _remainAsGunship]; +DMS_HeliParatrooper_Arr pushBack [_heli, _dropPoint, _remainAsGunship]; diff --git a/README.md b/README.md index 2a0a71a..7417de0 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ ___ ___ # Changelog: -### Test Branch: +### Test Branch **!!RC Now Available!!**: #### List Of new Config values: DMS_SpawnMissions_Scheduled @@ -130,6 +130,15 @@ ___ DMS_RareLootAmount DMS_ReinforcementHelis +#### April 14, 2016 (9:20 PM CST-America, RC): +* Fix script error with saltflats. +* "DMS_fnc_AddMissionToMonitor" will no longer convert given AI parameters to a list of objects, so you can now add other units to the mission (within the same group) without much issue. +* Micro-optimizations here and there. +* Fixed an issue with DMS_fnc_GetAllUnits such that it would return an empty list if given a list of AI objects. +* You can now set the maximum limit of paratrooper reinforcements. +* The pilot of the reinforcement heli should now fly away properly if configured to do so. +* Updated group reinforcement manager for compatibility with latest syntax for paratrooper reinforcements (NOTE: UNTESTED). + #### March 31, 2016 (6:00 PM CST-America): * You can now use "setVariable" to define individually on an AI vehicle its "DMS_DestructionChance". EG: ```_vehicle setVariable ["DMS_DestructionChance",100];``` to always destroy a vehicle when its crew is dead. From 610ab08c12b07858a4efee601c407c95d0b8baf6 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 15 Apr 2016 09:28:59 -0500 Subject: [PATCH 2/6] Fix --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf | 4 ++-- README.md | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 5bc43a9..0d1d1e7 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 = "April 14, 2016 (RC)"; + a3_DMS_version = "April 15, 2016 (RC2)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf index 42ec602..fbe68eb 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf @@ -123,10 +123,10 @@ if (!isNull _av) then if ( call - [ + ([ { (random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyVehicleChance]) }, { DMS_AI_destroyStaticWeapon && {(random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyStaticWeapon_chance])} } - ] select (_av isKindOf "StaticWeapon") + ] select (_av isKindOf "StaticWeapon")) ) then { _av setDamage 1; diff --git a/README.md b/README.md index 7417de0..64803e0 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,9 @@ ___ DMS_RareLootAmount DMS_ReinforcementHelis +#### April 15, 2016 (9:30 PM CST-America, RC): +* Fixed script error in OnKilled EH when handling a used AI vehicle. + #### April 14, 2016 (9:20 PM CST-America, RC): * Fix script error with saltflats. * "DMS_fnc_AddMissionToMonitor" will no longer convert given AI parameters to a list of objects, so you can now add other units to the mission (within the same group) without much issue. From c28ca8dfba51766d1420d82bfe5704aec7b940be Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 15 Apr 2016 20:46:28 -0500 Subject: [PATCH 3/6] Fix static weapon destruction --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf | 1 - README.md | 5 ++++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 0d1d1e7..db448ff 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 = "April 15, 2016 (RC2)"; + a3_DMS_version = "April 15, 2016 (RC3)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf index 1c9674d..4997e76 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf @@ -58,7 +58,6 @@ _guns = []; _gun = createVehicle [_MGClass, [0,0,0], [], 0, "CAN_COLLIDE"]; _gun setDir (random 360); _gun setPosATL _pos; - _gun addEventHandler ["GetOut",{(_this select 0) setDamage 1;}]; _gun lock 2; _group addVehicle _gun; diff --git a/README.md b/README.md index 64803e0..64a3e02 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,10 @@ ___ DMS_RareLootAmount DMS_ReinforcementHelis -#### April 15, 2016 (9:30 PM CST-America, RC): +#### April 15, 2016 (8:45 PM CST-America, RC): +* Fixed an issue where static weapons would always be destroyed, ignoring other configs. Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/)! + +#### April 15, 2016 (9:30 AM CST-America, RC): * Fixed script error in OnKilled EH when handling a used AI vehicle. #### April 14, 2016 (9:20 PM CST-America, RC): From 1c425a105905920686727427d6cf8260a2b7e8c3 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Wed, 20 Apr 2016 17:46:00 -0500 Subject: [PATCH 4/6] Slight tweaks --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf | 2 +- .../addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf | 5 ++++- @ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf | 2 ++ .../addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf | 3 +++ .../addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf | 2 ++ README.md | 4 ++++ 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index db448ff..4c3ffd2 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 = "April 15, 2016 (RC3)"; + a3_DMS_version = "April 20, 2016 (RC4)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf index 31ae22c..cf2526a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf @@ -71,7 +71,7 @@ _generatePos = }; }; -while{!_isValidSpot} do +while {!_isValidSpot} do { _attempts = _attempts+1; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf index 33dc92f..609e204 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf @@ -19,7 +19,7 @@ Returns a position. */ -private ["_centerPos", "_distance", "_posParameters", "_original_x", "_original_y", "_original_Blacklist", "_center_x", "_center_y", "_pos"]; +private ["_centerPos", "_distance", "_posParameters", "_original_x", "_original_y", "_original_Blacklist", "_center_x", "_center_y", "_usePresetOriginal", "_pos"]; if !(params [ @@ -62,6 +62,8 @@ DMS_findSafePosBlacklist = [] }; +_usePresetOriginal = DMS_UsePredefinedMissionLocations; +DMS_UsePredefinedMissionLocations = false; // NOW we get the position (hopefully) _pos = _posParameters call DMS_fnc_findSafePos; @@ -70,5 +72,6 @@ _pos = _posParameters call DMS_fnc_findSafePos; DMS_MinMax_X_Coords = _original_x; DMS_MinMax_Y_Coords = _original_y; DMS_findSafePosBlacklist = _original_Blacklist; +DMS_UsePredefinedMissionLocations = _usePresetOriginal; _pos diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf index 76658ff..27dbdde 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf @@ -69,6 +69,8 @@ _objs = _export apply _obj setPos _objPos; }; + _obj enableSimulationGlobal false; + _obj; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf index f5e5b55..2f40c0a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf @@ -65,6 +65,9 @@ _objs = _export apply _obj setPosATL _pos; _obj setVectorDirAndUp (_x select 3); }; + + _obj enableSimulationGlobal false; + _obj; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf index 902e65a..83607ac 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf @@ -67,6 +67,8 @@ _objs = _export apply _obj setVectorDirAndUp (_x select 3); }; + _obj enableSimulationGlobal false; + _obj; }; diff --git a/README.md b/README.md index 64a3e02..bad40bf 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,10 @@ ___ DMS_RareLootAmount DMS_ReinforcementHelis +#### April 20, 2016 (5:45 PM CST-America, RC): +* The new "DMS_fnc_FindSafePos_InRange" function will ignore the config "DMS_UsePredefinedMissionLocations". +* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip) + #### April 15, 2016 (8:45 PM CST-America, RC): * Fixed an issue where static weapons would always be destroyed, ignoring other configs. Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/)! From bf1ed941fb079a87cb6d27067a963ca27aa84a30 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Wed, 27 Apr 2016 18:37:45 -0500 Subject: [PATCH 5/6] Whoops I was using "DMS_MarkerText_ShowAICount" instead of "DMS_MarkerText_ShowAICount_Static" in "fn_AddMissionToMonitor_Static.sqf" --- .../addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf index c84f343..0fce46b 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf @@ -192,7 +192,7 @@ try DMS_StaticMission_Arr pushBack _arr; _added = true; - if (DMS_MarkerText_ShowAICount) then + if (DMS_MarkerText_ShowAICount_Static) then { _markerDot = _markers select 0; _markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count (_units call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]); From ea66d8ec7c7a7181763d944544ca030f52e74f62 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Wed, 27 Apr 2016 18:45:17 -0500 Subject: [PATCH 6/6] Preparation for Merge --- @ExileServer/addons/a3_dms/config.cpp | 2 +- README.md | 34 ++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 4c3ffd2..898ac8f 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 = "April 20, 2016 (RC4)"; + a3_DMS_version = "April 27, 2016"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/README.md b/README.md index bad40bf..9ddf5ae 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,36 @@ ___ ___ # Changelog: -### Test Branch **!!RC Now Available!!**: +#### April 27, 2016 (6:45 PM CST-America, RC): +* **NEW CONFIG VALUES** + + DMS_SpawnMissions_Scheduled + DMS_AI_WP_Radius_heli + DMS_AI_WP_Radius_heli + DMS_RHeli_Height + DMS_RHeli_MinDistFromDrop + DMS_RHeli_MaxDistFromDrop + DMS_RHeli_MinDistFromPlayers + DMS_RareLootAmount + DMS_ReinforcementHelis +* Several optimizations (mostly due to the new scripting commands introduced in 1.56) +* You can now spawn missions in scheduled environment. +* DMS Version is set in the "config.cpp", and grabbed in pre-init. +* You can now define how much rare loot to spawn. +* Limit # of attempts in "DMS_fnc_FindSafePos" to 5000. +* New function: DMS_fnc_FindSafePos_InRange; Uses "DMS_fnc_FindSafePos" and edits some variables to return a "safe" position within a certain area. +* New function: DMS_fnc_GetEmptySeats; Returns all empty seats in a vehicle. Not used by DMS, I thought I needed it and I realized I didn't afterwards. +* New function: DMS_fnc_HeliParatroopers_Monitor; Monitors helis/aircraft spawned for paratroopers. +* New function: DMS_fnc_SpawnHeliReinforcement; Spawns a heli/aircraft with paratroopers for reinforcement. +* New group reinforcement type: "heli_troopers". +* You can now choose whether or not to destroy or simply unlock a used AI vehicle (with a random percentage chance). +* You can now use "setVariable" to define individually on an AI vehicle its "DMS_DestructionChance". EG: ```_vehicle setVariable ["DMS_DestructionChance",100];``` to always destroy a vehicle when its crew is dead. +* "DMS_DestructionChance" values are defaulted to "DMS_AI_destroyStaticWeapon_chance" or "DMS_AI_destroyVehicleChance" for static or regular vehicles, respectively. +* Fixed an issue where static weapons would always be destroyed, ignoring other configs. Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/)! +* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip). +* Fixed an issue where AI units would be shown in static missions if configured to do so for dynamic missions (at least at first). + +### Test Branch (Now Integrated Live): #### List Of new Config values: DMS_SpawnMissions_Scheduled @@ -183,6 +212,9 @@ ___ * Several optimizations (mostly due to the new scripting commands introduced in 1.56) * You can now spawn missions in scheduled environment. +### End "March 1, 2016" Test Branch + + #### February 19, 2016 (5:45 PM CST-America): * Fixed a minor typo with a variable (part of the new Humanity support by DonkeyPunch).