From fdee4e45270f149f15613220cce13d6c9b37e615 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 25 Sep 2015 19:28:04 -0500 Subject: [PATCH] Relatively minor tweaks today * NEW CONFIG VALUES: DMS_SpawnMineWarningSigns DMS_BulletProofMines * You can now manually define the rare loot chance per crate. * You can now define the mine amount and radius directly from the call for DMS_fnc_SpawnMinefield. --- @ExileServer/addons/a3_dms/config.sqf | 2 + .../addons/a3_dms/scripts/fn_FillCrate.sqf | 15 ++++-- .../addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 11 ++-- .../a3_dms/scripts/fn_SpawnMinefield.sqf | 52 ++++++++++++++++--- README.md | 8 +++ 5 files changed, 73 insertions(+), 15 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 820bcd5..2fd9d28 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -69,6 +69,8 @@ DMS_DEBUG = false; 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. + DMS_SpawnMineWarningSigns = true; // Whether or not to spawn mine warning signs around a minefield. + DMS_BulletProofMines = true; // Whether or not you want to make the mines bulletproof. Prevents players from being able to shoot the mines and creating explosions. /*Mine settings*/ DMS_MinPlayerCount = 0; // Minimum number of players until mission start diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf index 7bddcf3..9b0b8a4 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf @@ -6,8 +6,9 @@ Usage: [ - _crate, // The crate object - _lootValues // Array, string, or number. String or number refers to a crate case in config.cfg; array determines random crate weapons/items/backpacks + _crate, // OBJECT: The crate object + _lootValues, // ARRAY, STRING, or NUMBER: String or number refers to a crate case in config.cfg; array determines random crate weapons/items/backpacks + _rareLootChance // (OPTIONAL) NUMBER: Manually define the percentage chance of spawning some rare items. ] call DMS_fnc_FillCrate; Loot values can be a number or a string with a corresponding "Crate Case" defined in the config. EG: DMS_CrateCase_Sniper. Or it can be an array. @@ -25,7 +26,7 @@ or an array as [_wepCount,_weps], where _wepCount is the number of weapons, and _weps is an array of weapons from which the guns are randomly selected. */ -private ["_crate","_lootValues","_wepCount","_weps","_itemCount","_items","_backpackCount","_backpacks","_weapon","_ammo","_item","_backpack","_crateValues"]; +private ["_crate","_lootValues","_wepCount","_weps","_itemCount","_items","_backpackCount","_backpacks","_weapon","_ammo","_item","_backpack","_crateValues","_rareLootChance","_marker"]; @@ -176,8 +177,14 @@ else if(DMS_RareLoot && {count DMS_RareLootList>0}) then { + _rareLootChance = DMS_RareLootChance; + if ((count _this)>2) then + { + _rareLootChance = param [2,DMS_RareLootChance,[0]]; + }; + // (Maybe) Add rare loot - if(random 100 < DMS_RareLootChance) then + if(random 100 < _rareLootChance) then { _item = DMS_RareLootList call BIS_fnc_selectRandom; if ((typeName _item)=="STRING") then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index 42601d9..865d938 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -30,11 +30,6 @@ if (!_OK) then diag_log format ["DMS ERROR :: Calling DMS_SpawnAIGroup with invalid parameters: %1",_this]; }; -if (_count < 1) exitWith -{ - diag_log format ["DMS ERROR :: Calling DMS_SpawnAIGroup with less than 1 _count! _this: %1",_this]; -}; - _pos_x = _pos select 0; _pos_y = _pos select 1; _pos_z = _pos select 2; @@ -76,6 +71,12 @@ _group = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side], _group setVariable ["DMS_LockLocality",nil]; _group setVariable ["DMS_SpawnedGroup",true]; +if (_count < 1) exitWith +{ + diag_log format ["DMS ERROR :: Calling DMS_SpawnAIGroup with less than 1 _count! _this: %1",_this]; + _group +}; + for "_i" from 1 to _count do { _unit = [_group,[_pos_x,_pos_y,_pos_z],_class,_difficulty,_side,"Soldier"] call DMS_fnc_SpawnAISoldier; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf index cc060ed..3fad2b5 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -4,9 +4,11 @@ Usage: [ - _centerPos, - _difficulty, - _side + _centerPos, // ARRAY: Position to spawn the minefield around + _difficulty, // STRING or ARRAY: The "difficulty" level of the minefield. Determines the number of mines and the radius it spawns at. String refers to a difficulty set in config, array is defined as [_mineCount,_radius]; + _side, // STRING: The "side" for which the mines should spawn. The spawned mines will be revealed to the AI so they don't run into it. + _spawnWarningSign, // (OPTIONAL) BOOL: Whether or not to spawn the warning signs around the minefield (at maximum radius, to the North/West/East/South) + _mineClassname // (OPTIONAL) STRING: The classname of the mine to spawn. ] call DMS_fnc_SpawnMinefield; */ @@ -17,11 +19,10 @@ _mines = []; if (DMS_SpawnMinesAroundMissions) then { - _OK = params [ ["_centerPos","",[[]],[2,3]], - ["_difficulty","",[""]], + ["_difficulty","",["",[]],[2]], ["_side","",[""]] ]; @@ -30,8 +31,24 @@ if (DMS_SpawnMinesAroundMissions) then diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnMinefield with invalid parameters: %1",_this]; }; + _spawnWarningSign = DMS_SpawnMineWarningSigns; + _mineClassname = "ATMine"; + if ((count _this)>3) then + { + _spawnWarningSign = param [3,DMS_SpawnMineWarningSigns,[true]]; + + if ((count _this)>4) then + { + _mineClassname = param [4,"ATMine",[true]]; + }; + }; + + _minesInfo = _difficulty; + if ((typeName _difficulty)=="STRING") then + { + _minesInfo = missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]]; + }; - _minesInfo = missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]]; _AISide = missionNamespace getVariable [format ["DMS_%1Side", _side], EAST]; @@ -45,12 +62,35 @@ if (DMS_SpawnMinesAroundMissions) then _minePos = [_centerPos,random _radius,random 360] call DMS_fnc_SelectOffsetPos; _mine = createMine ["ATMine", _minePos, [], 0]; + + // Fixes players shooting the mine and causing premature 'splosions + if (DMS_BulletProofMines) then + { + _mine allowDamage false; + }; + + //In case you're using directional mines such as tripwires/SLAMs + _mine setDir (random 360); + _AISide revealMine _mine; _mines pushBack _mine; }; + if (_spawnWarningSign) then + { + for "_i" from 0 to 359 step 90 do + { + _sign = createVehicle ["Land_Sign_Mines_F",[_centerPos, _radius+2, _i] call DMS_fnc_SelectOffsetPos, [], 0, "CAN_COLLIDE"]; + _sign setDir _i; + _sign setVectorUp [0,0,1]; + + // _mines array is for only cleanup atm, so just add them to the list + _mines pushBack _sign; + }; + }; + 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]; diff --git a/README.md b/README.md index 2093454..2550b5c 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,14 @@ if (!hasInterface && !isServer) then ## Changelog: +#### September 25, 2015 (7:30 PM CST-America): +* NEW CONFIG VALUES: + DMS_SpawnMineWarningSigns + DMS_BulletProofMines +* You can now manually define the rare loot chance per crate. +* You can now define the mine amount and radius directly from the call for DMS_fnc_SpawnMinefield. + + #### September 25, 2015 (1:30 AM CST-America): * NEW CONFIG VALUES: DMS_SpawnMinesAroundMissions