From 39af7c584c248cfaf26e6940cac0ddd1f9b4781a Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 25 Sep 2015 01:40:59 -0500 Subject: [PATCH] 'SPLOSIONS! (And some RPT spam reduction) * NEW CONFIG VALUES: DMS_SpawnMinesAroundMissions DMS_despawnMines_onCompletion DMS_MineInfo_easy DMS_MineInfo_moderate DMS_MineInfo_difficult DMS_MineInfo_hardcore DMS_explode_onRoadkill * You can now spawn randomly generated minefields around missions! Numberof mines and radius is dependent on difficulty. * Also, you can now spawn an explosion on an AI when it is roadkilled, causing a wheel or two of the roadkilling vehicle to break. * Commented out the spawning of static-relative conversion of base objects in test mission. * Included example of how to spawn the minefield in the test mission. * Reduced some of the RPT spam. * Smoke/IR grenades will only spawn on proper crates - you can now safely use DMS_fnc_FillCrate with non-crate objects but still have smoke available. --- @ExileServer/addons/a3_dms/config.cpp | 1 + @ExileServer/addons/a3_dms/config.sqf | 14 +++- .../a3_dms/missions/bandit/testmission.sqf | 16 +++-- .../a3_dms/scripts/fn_AddMissionToMonitor.sqf | 15 ++++- .../addons/a3_dms/scripts/fn_CreateMarker.sqf | 10 ++- .../addons/a3_dms/scripts/fn_FillCrate.sqf | 25 +++---- .../a3_dms/scripts/fn_MissionsMonitor.sqf | 10 ++- .../addons/a3_dms/scripts/fn_OnKilled.sqf | 10 +++ .../a3_dms/scripts/fn_SpawnAIStatic.sqf | 6 +- .../a3_dms/scripts/fn_SpawnAIVehicle.sqf | 7 +- .../a3_dms/scripts/fn_SpawnMinefield.sqf | 62 ++++++++++++++++++ Pre-Packed PBO/a3_dms.pbo | Bin 203861 -> 207382 bytes README.md | 17 +++++ 13 files changed, 167 insertions(+), 26 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 593cce7..520f923 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -60,6 +60,7 @@ class CfgFunctions class SpawnAIStatic {}; class SpawnBanditMission {}; class SpawnCrate {}; + class SpawnMinefield {}; class SpawnNonPersistentVehicle {}; class TargetsKilled {}; }; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 6f6798a..820bcd5 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -61,6 +61,15 @@ DMS_DEBUG = false; DMS_SpawnBoxSmoke = true; // Spawn a smoke grenade on mission box upon misson completion during daytime DMS_SpawnBoxIRGrenade = true; // Spawn an IR grenade on mission box upon misson completion during nighttime /*Crate/Box settings*/ + + /*Mine settings*/ + DMS_SpawnMinesAroundMissions = true; // Whether or not to spawn mines around AI missions that have them. + DMS_despawnMines_onCompletion = true; // Despawn mines spawned around missions when the mission is completed + DMS_MineInfo_easy = [5,50]; // Mine info for "easy" missions. This will spawn 5 mines within a 50m radius. + DMS_MineInfo_moderate = [10,50]; // Mine info for "moderate" missions. This will spawn 10 mines within a 50m radius. + DMS_MineInfo_difficult = [15,75]; // Mine info for "difficult" missions. This will spawn 15 mines within a 75m radius. + DMS_MineInfo_hardcore = [25,100]; // Mine info for "hardcore" missions. This will spawn 25 mines within a 100m radius. + /*Mine settings*/ DMS_MinPlayerCount = 0; // Minimum number of players until mission start DMS_MinServerFPS = 5; // Minimum server FPS for missions to start @@ -123,6 +132,7 @@ DMS_DEBUG = false; DMS_ai_disable_ramming_damage = true; // Disables damage due to ramming into AI. !!!NOTE: THIS WILL NOT BE RELIABLE WITH "DMS_ai_offload_to_client"!!! DMS_remove_roadkill = true; // Remove gear from AI bodies that are roadkilled DMS_remove_roadkill_chance = 50; // Percentage chance that roadkilled AI bodies will be deleted + DMS_explode_onRoadkill = true; // Whether or not to spawn an explosion when an AI gets run over. It will likely take out the 2 front wheels. Should help mitigate the ineffective AI vs. striders issue ;) DMS_RemoveNVG = false; // Remove NVGs from AI bodies DMS_MaxAIDistance = 500; // The maximum distance an AI unit can be from a mission before he is killed. Helps with AI running away and forcing the mission to keep running. Set to 0 if you don't want it. @@ -146,8 +156,8 @@ DMS_DEBUG = false; DMS_ai_skill_random = ["hardcore","difficult","difficult","difficult","moderate","moderate","moderate","moderate","easy","easy"]; // Skill frequencies for "random" AI skills | Default: 10% hardcore, 30% difficult, 40% moderate, and 20% easy DMS_AI_WP_Radius_easy = 20; // Waypoint radius for "easy" AI DMS_AI_WP_Radius_moderate = 40; // Waypoint radius for "moderate" AI - DMS_AI_WP_Radius_difficult = 75; // Waypoint radius for "difficult" AI - DMS_AI_WP_Radius_hardcore = 150; // Waypoint radius for "hardcore" AI + DMS_AI_WP_Radius_difficult = 55; // Waypoint radius for "difficult" AI + DMS_AI_WP_Radius_hardcore = 75; // Waypoint radius for "hardcore" AI DMS_AI_WP_Radius_base = 5; // Waypoint radius for AI in bases DMS_static_weapons = [ // Static weapons for AI diff --git a/@ExileServer/addons/a3_dms/missions/bandit/testmission.sqf b/@ExileServer/addons/a3_dms/missions/bandit/testmission.sqf index cafee48..932f906 100644 --- a/@ExileServer/addons/a3_dms/missions/bandit/testmission.sqf +++ b/@ExileServer/addons/a3_dms/missions/bandit/testmission.sqf @@ -13,7 +13,7 @@ _side = "bandit"; // find position -_pos = call DMS_fnc_findSafePos; +_pos = [10,10] call DMS_fnc_findSafePos; // Set general mission difficulty @@ -76,14 +76,21 @@ _veh = _side ] call DMS_fnc_SpawnAIVehicle; - +/* _baseObjs = [ "base1STATIC", _pos ] call DMS_fnc_ImportFromM3E_Convert; +*/ +_baseObjs = []; - +_mines = +[ + _pos, + _difficulty, + _side +] call DMS_fnc_SpawnMinefield; // Define mission-spawned AI Units @@ -97,7 +104,8 @@ _missionObjs = [ _staticGuns+[_veh]+_baseObjs, [_vehicle], - [[_crate,"Sniper"]] + [[_crate,"Sniper"]], + _mines ]; // Define Mission Start message diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf index c1a8dab..93e166b 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf @@ -50,7 +50,7 @@ "_completionInfo", "_timeOutInfo", "_inputUnits", "_missionObjs", "_messages", "_markers", "_side", "_timeStarted", "_timeUntilFail" */ -private ["_added", "_pos", "_OK", "_completionInfo", "_timeOutInfo", "_inputUnits", "_missionObjs", "_messages", "_markers", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_side","_arr"]; +private ["_added", "_pos", "_OK", "_completionInfo", "_timeOutInfo", "_inputUnits", "_missionObjs", "_mines", "_messages", "_markers", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_side","_arr"]; _added = false; @@ -61,7 +61,7 @@ _OK = params ["_completionInfo","",[[]]], ["_timeOutInfo","",[[]],[1,2]], ["_inputUnits","",[[]]], - ["_missionObjs","",[[]],[3]], + ["_missionObjs","",[[]],[3,4]], ["_messages","",[[]],[2]], ["_markers","",[[]],[2]], ["_side","bandit",[""]] @@ -117,6 +117,14 @@ try throw format["_missionObjs |%1|",_missionObjs]; }; + _mines = []; + + if ((count _missionObjs)>3) then + { + _mines = _missionObjs param [3,[],[[]]]; + }; + + _OK = _messages params [ ["_msgWIN","",[""]], @@ -151,7 +159,8 @@ try [ _buildings, _vehs, - _crate_info_array + _crate_info_array, + _mines ], [ _msgWIN, diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf index e104867..da19aa1 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf @@ -26,8 +26,7 @@ params [ ["_pos","ERROR",[[]],[2,3]], ["_text","ERROR",[""]], - ["_difficulty","moderate",[""]], - ["_randomMarker",DMS_MarkerPosRandomization,[false]] + ["_difficulty","moderate",[""]] ]; if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith @@ -37,6 +36,13 @@ if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith []; }; + +_randomMarker = DMS_MarkerPosRandomization; +if ((count _this)>3) then +{ + _randomMarker = param [3,DMS_MarkerPosRandomization,[false]]; +}; + _num = DMS_MissionCount; switch (_difficulty) do diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf index b015763..7bddcf3 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf @@ -188,17 +188,20 @@ if(DMS_RareLoot && {count DMS_RareLootList>0}) then }; }; - -if(DMS_SpawnBoxSmoke && {sunOrMoon == 1}) then +// In case somebody wants to use fillCrate on a vehicle but also wants to use smoke, don't create smoke/IR strobe unless it's a crate +if (_crate isKindOf "ReammoBox_F") then { - _marker = "SmokeShellPurple" createVehicle getPosATL _crate; - _marker setPosATL (getPosATL _crate); - _marker attachTo [_crate,[0,0,0]]; -}; + if(DMS_SpawnBoxSmoke && {sunOrMoon == 1}) then + { + _marker = "SmokeShellPurple" createVehicle getPosATL _crate; + _marker setPosATL (getPosATL _crate); + _marker attachTo [_crate,[0,0,0]]; + }; -if (DMS_SpawnBoxIRGrenade && {sunOrMoon != 1}) then -{ - _marker = "B_IRStrobe" createVehicle getPosATL _crate; - _marker setPosATL (getPosATL _crate); - _marker attachTo [_crate, [0,0,0.5]]; + if (DMS_SpawnBoxIRGrenade && {sunOrMoon != 1}) then + { + _marker = "B_IRStrobe" createVehicle getPosATL _crate; + _marker setPosATL (getPosATL _crate); + _marker attachTo [_crate, [0,0,0.5]]; + }; }; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor.sqf index 95efd68..2cafb5c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor.sqf @@ -25,7 +25,7 @@ */ if (DMS_Mission_Arr isEqualTo []) exitWith {}; // Empty array, no missions running -private ["_pos", "_success", "_timeStarted", "_timeUntilFail", "_units", "_buildings", "_vehs", "_crate_info_array", "_msgWIN", "_msgLose", "_markers", "_missionSide", "_arr", "_cleanupList"]; +private ["_pos", "_success", "_timeStarted", "_timeUntilFail", "_units", "_buildings", "_vehs", "_crate_info_array", "_mines", "_msgWIN", "_msgLose", "_markers", "_missionSide", "_arr", "_cleanupList"]; { @@ -43,6 +43,7 @@ private ["_pos", "_success", "_timeStarted", "_timeUntilFail", "_units", "_build _buildings = _x select 4 select 0; _vehs = _x select 4 select 1; _crate_info_array = _x select 4 select 2; + _mines = _x select 4 select 3; _msgWIN = _x select 5 select 0; _msgLose = _x select 5 select 1; _markers = _x select 6; @@ -75,6 +76,13 @@ private ["_pos", "_success", "_timeStarted", "_timeUntilFail", "_units", "_build _x call DMS_fnc_FillCrate; } forEach _crate_info_array; + if (DMS_despawnMines_onCompletion) then + { + { + deleteVehicle _x; + } forEach _mines; + }; + _msgWIN call DMS_fnc_BroadcastMissionStatus; [_markers,"win"] call DMS_fnc_RemoveMarkers; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf index 2148d77..1d7dff6 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf @@ -269,6 +269,16 @@ if (isPlayer _killer) then _roadKilled = true; + if (DMS_explode_onRoadkill) then + { + _boom = createVehicle ["SLAMDirectionalMine_Wire_Ammo", ASLToAGL(getPosWorld _unit), [], 0, "CAN_COLLIDE"]; + _boom setDamage 1; + if (DMS_DEBUG) then + { + diag_log format ["DMS_DEBUG OnKilled :: %1 roadkilled an AI! Creating mine at the roadkilled AI's position!",name _killer]; + }; + }; + // Remove gear from roadkills if configured to do so if (DMS_remove_roadkill && {(random 100) <= DMS_remove_roadkill_chance}) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStatic.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStatic.sqf index 896e7ad..00c6b91 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStatic.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStatic.sqf @@ -38,7 +38,11 @@ if (!_OK) exitWith diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStatic with invalid parameters: %1",_this]; }; -_MGClassInput = param [5,"random",[""]]; +_MGClassInput = "random"; +if ((count _this)>5) then +{ + _MGClassInput = param [5,"random",[""]]; +}; _guns = []; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf index 350ca37..c4cc50f 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf @@ -48,8 +48,11 @@ if (!_OK) exitWith // Simply use _spawnPos if _gotoPos isn't defined. Yes, you might get "param"/"params" RPT spam. Deal with it ;) _gotoPos = _positions param [1,_spawnPos,[[]],[2,3]]; - -_vehClass = param [5,"random",[""]]; +_vehClass = "random"; +if ((count _this)>5) then +{ + _vehClass = param [5,"random",[""]]; +}; if (_vehClass == "random") then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf new file mode 100644 index 0000000..cc060ed --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -0,0 +1,62 @@ +/* + DMS_fnc_SpawnMinefield + Created by eraser1 + + Usage: + [ + _centerPos, + _difficulty, + _side + ] call DMS_fnc_SpawnMinefield; +*/ + +private ["_centerPos", "_difficulty", "_side", "_mines", "_minesInfo", "_AISide", "_mineCount", "_radius"]; + + +_mines = []; + +if (DMS_SpawnMinesAroundMissions) then +{ + + _OK = params + [ + ["_centerPos","",[[]],[2,3]], + ["_difficulty","",[""]], + ["_side","",[""]] + ]; + + if (!_OK) exitWith + { + diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnMinefield with invalid parameters: %1",_this]; + }; + + + _minesInfo = missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]]; + _AISide = missionNamespace getVariable [format ["DMS_%1Side", _side], EAST]; + + + _mineCount = _minesInfo select 0; + _radius = _minesInfo select 1; + + + for "_i" from 1 to _mineCount do + { + private ["_minePos", "_mine"]; + + _minePos = [_centerPos,random _radius,random 360] call DMS_fnc_SelectOffsetPos; + _mine = createMine ["ATMine", _minePos, [], 0]; + _AISide revealMine _mine; + + + _mines pushBack _mine; + }; + + if (DMS_DEBUG) then + { + diag_log format ["DMS_DEBUG SpawnMinefield :: Spawned %1 mines around %2 with _minesInfo: %3 | _mines: %4",count _mines,_centerPos,_minesInfo,_mines]; + }; +}; + + + +_mines \ No newline at end of file diff --git a/Pre-Packed PBO/a3_dms.pbo b/Pre-Packed PBO/a3_dms.pbo index a716badad48bfaba15c7639925ee6126a1b3a711..8b7193946be2d2d264f0c3305ddfa34547f583e8 100644 GIT binary patch delta 3299 zcmb7GZEPGz8D__4$9wjj>)47D2a)lnjz75E`JS%8mA3=QIkoas z%c0QqF1d8L2PLm>zS6Rwgge7>Y3#i~vNK#c()y`z?|@tyzZFRK4s1Tr`nD48XsxY* z%Z}E{<>0-cSA%ltowowXS1T_D*YKQalblJcY(4l;v&5YHYakhF-t27qL5o^PZ9doe zZs&L?sK$o*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