DMSv1 is Live :D

Still a few things left to do but... the system works! ;)
This commit is contained in:
eraser1 2015-08-30 23:51:06 -05:00
parent 287508e6cb
commit 641d40c157
10 changed files with 241 additions and 76 deletions

View File

@ -31,6 +31,7 @@ DMS_OnKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\script
DMS_SetGroupBehavior = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SetGroupBehavior.sqf";
DMS_AddMissionToMonitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\AddMissionToMonitor.sqf";
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CreateMarker.sqf";
DMS_FindSuppressor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FindSuppressor.sqf";//<--- TODO Improve
//Load config
#include "config.sqf";

View File

@ -5,7 +5,7 @@
Called from DMS_selectMission
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added"];
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
@ -49,17 +49,31 @@ _crate_loot_values =
];
// Setup Mission Start message
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Setup Mission Win message
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Setup Mission Lose message
_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Set mission name (for map marker and logging)
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group";
// Create Markers
@ -70,7 +84,10 @@ _markers =
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
@ -82,28 +99,42 @@ _added =
[
"playerNear",
[_pos,DMS_playerNearRadius]
],
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
[
_group
],
[
[], // No spawned buildings
[_crate],
[_crate_loot_values]
],
[_msgWIN,_msgLose],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName];
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
@ -114,5 +145,5 @@ _msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty];
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -2,7 +2,7 @@
Sample mission (duplicate for testing purposes)
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added"];
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
@ -46,17 +46,31 @@ _crate_loot_values =
];
// Setup Mission Start message
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Setup Mission Win message
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Setup Mission Lose message
_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Set mission name (for map marker and logging)
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group2";
// Create Markers
@ -67,7 +81,10 @@ _markers =
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
@ -79,28 +96,42 @@ _added =
[
"playerNear",
[_pos,DMS_playerNearRadius]
],
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
[
_group
],
[
[], // No spawned buildings
[_crate],
[_crate_loot_values]
],
[_msgWIN,_msgLose],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName];
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
@ -111,5 +142,5 @@ _msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty];
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -2,7 +2,7 @@
Sample mission (duplicate for testing purposes)
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added"];
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
@ -46,17 +46,31 @@ _crate_loot_values =
];
// Setup Mission Start message
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Setup Mission Win message
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Setup Mission Lose message
_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Set mission name (for map marker and logging)
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group3";
// Create Markers
@ -67,7 +81,10 @@ _markers =
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
@ -79,28 +96,42 @@ _added =
[
"playerNear",
[_pos,DMS_playerNearRadius]
],
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
[
_group
],
[
[], // No spawned buildings
[_crate],
[_crate_loot_values]
],
[_msgWIN,_msgLose],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName];
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
@ -111,5 +142,5 @@ _msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty];
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -2,7 +2,7 @@
Sample mission (duplicate for testing purposes)
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added"];
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
@ -46,17 +46,31 @@ _crate_loot_values =
];
// Setup Mission Start message
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Setup Mission Win message
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Setup Mission Lose message
_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Set mission name (for map marker and logging)
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group4";
// Create Markers
@ -67,7 +81,10 @@ _markers =
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
@ -79,28 +96,42 @@ _added =
[
"playerNear",
[_pos,DMS_playerNearRadius]
],
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
[
_group
],
[
[], // No spawned buildings
[_crate],
[_crate_loot_values]
],
[_msgWIN,_msgLose],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName];
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
@ -111,5 +142,5 @@ _msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty];
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -18,7 +18,7 @@ DMS_BMissionDelay = (DMS_TimeBetweenMissions select 0) + random((DMS_TimeBetween
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG mission_init :: Random time between missions is initialized at %1s | DMS_BMissionLastStart: %2",DMS_BMissionDelay,DMS_BMissionLastStart];
diag_log format ["DMS_DEBUG mission_init :: Random time between missions is initially set to %1s | DMS_BMissionLastStart: %2",DMS_BMissionDelay,DMS_BMissionLastStart];
};
// Set mission frequencies from config

View File

@ -35,7 +35,7 @@
[
[_cleanupObj1,_cleanupObj2,...,_cleanupObjX],
[_crate,_vehicle1,_vehicle2,...,_vehicleX],
[_crate_loot_values]
_crate_loot_values
],
[_msgWIN,_msgLose],
[_markerDot,_markerCircle],

View File

@ -82,7 +82,7 @@ _clean =
{
if (!isNull _x) then
{
// Group cleanup should only be called when mission times out, so no need to check for nearby players
// Group cleanup should only be called when it has to be deleted regardless, so no need to check for nearby players
{
_x call _clean;
false;

View File

@ -0,0 +1,40 @@
/*
DMS_FindSuppressor
Taken from WAI
Modified by eraser1
Usage:
_weaponClassName call DMS_FindSuppressor;
*/
private["_weapon","_result","_ammoName"];
_result = "";
_weapon = _this;
// Zafir accepts no suppressors :(
if (_weapon=="LMG_Zafir_F") exitWith {""};
_ammoName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName");
if ((_ammoName find "5.56") > -1) then
{
_result = "muzzle_snds_M";
};
if ((_ammoName find "6.5") > -1) then
{
_result = "muzzle_snds_H";
};
if ((_ammoName find "7.62") > -1) then
{
_result = "muzzle_snds_H";
};
//TODO Add functionality for 9.3 and .338
_result

View File

@ -143,7 +143,7 @@ if (!_useCustomGear) then
if((random 100) <= (missionNamespace getVariable [format["DMS_%1_suppressor_chance",_type],0])) then
{
_suppressor = _weapon call find_suitable_suppressor;
_suppressor = _weapon call DMS_FindSuppressor;
if(_suppressor != "") then
{
_unit addPrimaryWeaponItem _suppressor;