mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
Improve Crate Mechanics
You can now have multiple crates in a mission (or none at all!). Keep in mind that this changes the way you define your crates and their loot values
This commit is contained in:
parent
d9d287d69e
commit
b83a9e6746
@ -523,6 +523,6 @@ DMS_DEBUG = true;
|
||||
// Debug Overwrites
|
||||
if(DMS_DEBUG) then {
|
||||
DMS_TimeBetweenMissions = [30,60];
|
||||
DMS_MissionTimeOut = [240,300];
|
||||
DMS_MissionTimeOut = [60,90];
|
||||
diag_log format ["DMS_DEBUG CONFIG :: Overriding DMS_TimeBetweenMissions (%1) and DMS_MissionTimeOut (%2)",DMS_TimeBetweenMissions,DMS_MissionTimeOut];
|
||||
};
|
@ -5,7 +5,7 @@
|
||||
Called from DMS_selectMission
|
||||
*/
|
||||
|
||||
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added","_wreck"];
|
||||
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate1", "_crate_loot_values1", "_crate2", "_crate_loot_values2", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added","_wreck"];
|
||||
|
||||
// For logging purposes
|
||||
_num = DMS_MissionCount;
|
||||
@ -37,18 +37,25 @@ _group =
|
||||
] call DMS_SpawnAIGroup;
|
||||
|
||||
|
||||
// Create Crate
|
||||
_crate = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
|
||||
// Create Crates
|
||||
_crate1 = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
|
||||
_crate2 = ["Box_NATO_Wps_F",[(_pos select 0)+2,(_pos select 1)-1,0]] call DMS_SpawnCrate;
|
||||
|
||||
_wreck = createVehicle ["Land_Wreck_Ural_F",[(_pos select 0) - 10, (_pos select 1),-0.2],[], 0, "CAN_COLLIDE"];
|
||||
|
||||
// Set crate loot values
|
||||
_crate_loot_values =
|
||||
_crate_loot_values1 =
|
||||
[
|
||||
2, // Weapons
|
||||
15, // Items
|
||||
2 // Backpacks
|
||||
];
|
||||
_crate_loot_values2 =
|
||||
[
|
||||
1, // Weapons
|
||||
20, // Items
|
||||
5 // Backpacks
|
||||
];
|
||||
|
||||
|
||||
// Define mission-spawned AI Units
|
||||
@ -61,8 +68,8 @@ _missionAIUnits =
|
||||
_missionObjs =
|
||||
[
|
||||
[_wreck],
|
||||
[_crate],
|
||||
_crate_loot_values
|
||||
[],
|
||||
[[_crate1,_crate_loot_values1],[_crate2,_crate_loot_values2]]
|
||||
];
|
||||
|
||||
// Define Mission Start message
|
||||
@ -127,6 +134,10 @@ if !(_added) exitWith
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
{
|
||||
_cleanup pushBack (_x select 0);
|
||||
} foreach (_missionObjs select 2);
|
||||
|
||||
_cleanup call DMS_CleanUp;
|
||||
|
||||
|
||||
|
@ -39,7 +39,6 @@ _group =
|
||||
|
||||
// Create Crate
|
||||
_crate = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
|
||||
_crate2 = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
|
||||
|
||||
// Set crate loot values
|
||||
_crate_loot_values =
|
||||
@ -59,9 +58,9 @@ _missionAIUnits =
|
||||
// Define mission-spawned objects and loot values
|
||||
_missionObjs =
|
||||
[
|
||||
[], // No spawned buildings
|
||||
[_crate,_crate2],
|
||||
_crate_loot_values
|
||||
[],
|
||||
[],
|
||||
[[_crate,_crate_loot_values]]
|
||||
];
|
||||
|
||||
// Define Mission Start message
|
||||
@ -126,6 +125,10 @@ if !(_added) exitWith
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
{
|
||||
_cleanup pushBack (_x select 0);
|
||||
} foreach (_missionObjs select 2);
|
||||
|
||||
_cleanup call DMS_CleanUp;
|
||||
|
||||
|
||||
|
@ -58,9 +58,9 @@ _missionAIUnits =
|
||||
// Define mission-spawned objects and loot values
|
||||
_missionObjs =
|
||||
[
|
||||
[], // No spawned buildings
|
||||
[_crate],
|
||||
_crate_loot_values
|
||||
[],
|
||||
[],
|
||||
[[_crate,_crate_loot_values]]
|
||||
];
|
||||
|
||||
// Define Mission Start message
|
||||
@ -125,6 +125,10 @@ if !(_added) exitWith
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
{
|
||||
_cleanup pushBack (_x select 0);
|
||||
} foreach (_missionObjs select 2);
|
||||
|
||||
_cleanup call DMS_CleanUp;
|
||||
|
||||
|
||||
|
@ -56,10 +56,9 @@ _missionAIUnits =
|
||||
_missionObjs =
|
||||
[
|
||||
[], // No spawned buildings
|
||||
[_crate],
|
||||
_crate_loot_values
|
||||
[],
|
||||
[[_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];
|
||||
|
||||
@ -122,6 +121,10 @@ if !(_added) exitWith
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
{
|
||||
_cleanup pushBack (_x select 0);
|
||||
} foreach (_missionObjs select 2);
|
||||
|
||||
_cleanup call DMS_CleanUp;
|
||||
|
||||
|
||||
|
@ -56,8 +56,8 @@ _missionAIUnits =
|
||||
_missionObjs =
|
||||
[
|
||||
[], // No spawned buildings
|
||||
[_crate],
|
||||
_crate_loot_values
|
||||
[],
|
||||
[[_crate,_crate_loot_values]]
|
||||
];
|
||||
|
||||
// Define Mission Start message
|
||||
@ -122,6 +122,10 @@ if !(_added) exitWith
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
{
|
||||
_cleanup pushBack (_x select 0);
|
||||
} foreach (_missionObjs select 2);
|
||||
|
||||
_cleanup call DMS_CleanUp;
|
||||
|
||||
|
||||
|
@ -56,8 +56,8 @@ _missionAIUnits =
|
||||
_missionObjs =
|
||||
[
|
||||
[], // No spawned buildings
|
||||
[_crate],
|
||||
_crate_loot_values
|
||||
[],
|
||||
[[_crate,_crate_loot_values]]
|
||||
];
|
||||
|
||||
// Define Mission Start message
|
||||
@ -122,6 +122,10 @@ if !(_added) exitWith
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
{
|
||||
_cleanup pushBack (_x select 0);
|
||||
} foreach (_missionObjs select 2);
|
||||
|
||||
_cleanup call DMS_CleanUp;
|
||||
|
||||
|
||||
|
@ -34,8 +34,11 @@
|
||||
],
|
||||
[
|
||||
[_cleanupObj1,_cleanupObj2,...,_cleanupObjX],
|
||||
[_crate,_vehicle1,_vehicle2,...,_vehicleX],
|
||||
_crate_loot_values
|
||||
[_vehicle1,_vehicle2,...,_vehicleX],
|
||||
[
|
||||
[_crate1,_crate_loot_values1],
|
||||
[_crate2,_crate_loot_values2]
|
||||
]
|
||||
],
|
||||
[_msgWIN,_msgLose],
|
||||
[_markerDot,_markerCircle],
|
||||
@ -47,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", "_loot", "_crate_loot_values", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_side","_arr"];
|
||||
private ["_added", "_pos", "_OK", "_completionInfo", "_timeOutInfo", "_inputUnits", "_missionObjs", "_messages", "_markers", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_side","_arr"];
|
||||
|
||||
|
||||
_added = false;
|
||||
@ -105,8 +108,8 @@ try
|
||||
_OK = _missionObjs params
|
||||
[
|
||||
["_buildings","",[[]]],
|
||||
["_loot","",[[]]],
|
||||
["_crate_loot_values","",[[]],[3]]
|
||||
["_vehs","",[[]]],
|
||||
["_crate_info_array","",[[]]]
|
||||
];
|
||||
|
||||
if (!_OK) then
|
||||
@ -147,8 +150,8 @@ try
|
||||
_units,
|
||||
[
|
||||
_buildings,
|
||||
_loot,
|
||||
_crate_loot_values
|
||||
_vehs,
|
||||
_crate_info_array
|
||||
],
|
||||
[
|
||||
_msgWIN,
|
||||
|
@ -22,10 +22,6 @@ if (DMS_DEBUG) then
|
||||
|
||||
if !((typeName _this) == "ARRAY") then
|
||||
{
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log ("DMS_DEBUG CleanUp :: Converting single object into array: "+str _this);
|
||||
};
|
||||
_this = [_this];
|
||||
};
|
||||
|
||||
|
@ -12,32 +12,28 @@
|
||||
[_AIUnit1,_AIUnit2,...,_AIUnitX],
|
||||
[
|
||||
[_cleanupObj1,_cleanupObj2,...,_cleanupObjX],
|
||||
[_crate,_vehicle1,_vehicle2,...,_vehicleX],
|
||||
[_crate_loot_values]
|
||||
[_vehicle1,_vehicle2,...,_vehicleX],
|
||||
[
|
||||
[_crate1,_crate_loot_values1],
|
||||
[_crate2,_crate_loot_values2]
|
||||
]
|
||||
],
|
||||
[_msgWIN,_msgLose],
|
||||
[_markerDot,_markerCircle],
|
||||
_side
|
||||
]
|
||||
*/
|
||||
if (DMS_Mission_Arr isEqualTo []) exitWith // Empty array, no missions running
|
||||
{
|
||||
/* Removed because RPT spam
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log "DMS_DEBUG MissionStatusCheck :: DMS_Mission_Arr is empty!";
|
||||
};
|
||||
*/
|
||||
};
|
||||
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"];
|
||||
|
||||
|
||||
_index = 0;
|
||||
{
|
||||
call
|
||||
try
|
||||
{
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG MissionStatusCheck :: Checking Mission Status (index %1): %2",_index,_x];
|
||||
diag_log format ["DMS_DEBUG MissionStatusCheck :: Checking Mission Status (index %1): %2",_forEachIndex,_x];
|
||||
};
|
||||
_pos = _x select 0;
|
||||
_success = (_x select 1) call DMS_MissionSuccessState;
|
||||
@ -45,14 +41,14 @@ _index = 0;
|
||||
_timeUntilFail = _x select 2 select 1;
|
||||
_units = _x select 3;
|
||||
_buildings = _x select 4 select 0;
|
||||
_loot = _x select 4 select 1;
|
||||
_crate_loot_values = _x select 4 select 2;
|
||||
_vehs = _x select 4 select 1;
|
||||
_crate_info_array = _x select 4 select 2;
|
||||
_msgWIN = _x select 5 select 0;
|
||||
_msgLose = _x select 5 select 1;
|
||||
_markers = _x select 6;
|
||||
_missionSide = _x select 7;
|
||||
|
||||
if (_success) exitWith
|
||||
if (_success) then
|
||||
{
|
||||
DMS_CleanUpList pushBack [_units+_buildings,diag_tickTime,DMS_CompletedMissionCleanupTime];
|
||||
|
||||
@ -65,32 +61,36 @@ _index = 0;
|
||||
// Not yet implemented
|
||||
};
|
||||
|
||||
_arr = DMS_Mission_Arr deleteAt _index;
|
||||
_arr = DMS_Mission_Arr deleteAt _forEachIndex;
|
||||
|
||||
{
|
||||
_x call DMS_FillCrate;
|
||||
} forEach _crate_info_array;
|
||||
|
||||
[_loot select 0,_crate_loot_values] call DMS_FillCrate;
|
||||
_msgWIN call DMS_BroadcastMissionStatus;
|
||||
[_markers,"win"] call DMS_RemoveMarkers;
|
||||
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG MissionStatusCheck :: Mission Success at %1 with message %2.",_pos,_msgWIN];
|
||||
};
|
||||
throw format ["Mission Success at %1 with message %2.",_pos,_msgWIN];
|
||||
};
|
||||
|
||||
if (DMS_MissionTimeoutReset && {[_pos,DMS_MissionTimeoutResetRange] call ExileServer_util_position_isPlayerNearby}) exitWith
|
||||
if (DMS_MissionTimeoutReset && {[_pos,DMS_MissionTimeoutResetRange] call ExileServer_util_position_isPlayerNearby}) then
|
||||
{
|
||||
_x set [2,[diag_tickTime,_timeUntilFail]];
|
||||
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG MissionStatusCheck :: Mission Timeout Extended at %1 with timeout after %2 seconds. Position: %3",diag_tickTime,_timeUntilFail,_pos];
|
||||
};
|
||||
throw format ["Mission Timeout Extended at %1 with timeout after %2 seconds. Position: %3",diag_tickTime,_timeUntilFail,_pos];
|
||||
};
|
||||
|
||||
if ((diag_tickTime-_timeStarted)>_timeUntilFail) exitWith
|
||||
if ((diag_tickTime-_timeStarted)>_timeUntilFail) then
|
||||
{
|
||||
//Nobody is nearby so just cleanup objects from here
|
||||
(_units+_buildings+_loot) call DMS_CleanUp;
|
||||
_cleanupList = (_units+_buildings+_vehs);
|
||||
|
||||
{
|
||||
_cleanupList pushBack (_x select 0);
|
||||
} forEach _crate_info_array;
|
||||
|
||||
_cleanupList call DMS_CleanUp;
|
||||
|
||||
|
||||
if (_missionSide == "bandit") then
|
||||
{
|
||||
@ -101,16 +101,19 @@ _index = 0;
|
||||
// Not yet implemented
|
||||
};
|
||||
|
||||
_arr = DMS_Mission_Arr deleteAt _index;
|
||||
_arr = DMS_Mission_Arr deleteAt _forEachIndex;
|
||||
|
||||
_msgLose call DMS_BroadcastMissionStatus;
|
||||
[_markers,"lose"] call DMS_RemoveMarkers;
|
||||
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG MissionStatusCheck :: Mission Fail at %1 with message %2.",_pos,_msgLose];
|
||||
};
|
||||
throw format ["Mission Fail at %1 with message %2.",_pos,_msgLose];
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (DMS_DEBUG) then
|
||||
{
|
||||
diag_log format ["DMS_DEBUG MissionStatusCheck :: %1",_exception];
|
||||
};
|
||||
};
|
||||
_index = _index + 1;
|
||||
} forEach DMS_Mission_Arr;
|
Loading…
Reference in New Issue
Block a user