Fixes and Features (UNTESTED)

Feel free to test :)
This commit is contained in:
eraser1 2016-02-07 14:24:35 -06:00
parent ff9cbb49e1
commit e07bc27e3a
16 changed files with 131 additions and 79 deletions

View File

@ -35,7 +35,7 @@ DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific t
/*General settings for static missions*/
DMS_StaticMission = true; // Enable/disable static mission system.
DMS_MaxStaticMissions = 1; // Maximum number of Static Missions running at the same time. It's recommended you set this to the same amount of static missions that you have in total.
DMS_MaxStaticMissions = 1; // Maximum number of Static Missions running at the same time. It's recommended you set this to the same amount of static missions that you have in total. This config will be ignored by "DMS_StaticMissionsOnServerStart".
DMS_TimeToFirstStaticMission = [30,30]; // [Minimum,Maximum] time between first static mission spawn. | DEFAULT: 3-7 minutes.
DMS_TimeBetweenStaticMissions = [900,1800]; // [Minimum,Maximum] time between static missions (if static mission limit is not reached) | DEFAULT: 15-30 mins
DMS_StaticMissionTimeOut = [1800,3600]; // [Minimum,Maximum] time it will take for a static mission to timeout | DEFAULT: 30-60 mins
@ -116,8 +116,12 @@ DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific t
DMS_MinDistFromEastBorder = 250; // Missions won't spawn in a position this many meters close to the easter map border.
DMS_MinDistFromSouthBorder = 250; // Missions won't spawn in a position this many meters close to the southern map border.
DMS_MinDistFromNorthBorder = 250; // Missions won't spawn in a position this many meters close to the northern map border.
DMS_SpawnZoneMarkerTypes = ["ExileSpawnZone"]; // If you're using custom spawn zone markers, make sure you define them here. CASE SENSITIVE!!!
DMS_TraderZoneMarkerTypes = ["ExileTraderZone"]; // If you're using custom trader markers, make sure you define them here. CASE SENSITIVE!!!
DMS_SpawnZoneMarkerTypes = [ // If you're using custom spawn zone markers, make sure you define them here. CASE SENSITIVE!!!
"ExileSpawnZone"
];
DMS_TraderZoneMarkerTypes = [ // If you're using custom trader markers, make sure you define them here. CASE SENSITIVE!!!
"ExileTraderZone"
];
/*Mission spawn location settings*/
DMS_MinWaterDepth = 20; // Minimum depth of water that an underwater mission can spawn at.
@ -797,7 +801,9 @@ DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific t
"Exile_Car_Van_Guerilla01",
"Exile_Car_Zamak",
"Exile_Car_Tempest",
"Exile_Car_HEMMT"
"Exile_Car_HEMMT",
"Exile_Car_Ural_Open_Military",
"Exile_Car_Ural_Covered_Military"
];
DMS_RefuelTrucks = [ // List of refuel trucks that can spawn
@ -827,4 +833,8 @@ DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific t
"Exile_Chopper_Hellcat_Green",
"Exile_Chopper_Taru_Transport_Black"
];
DMS_CarThievesVehicles = [ // List of vehicles that can spawn in the "car thieves" mission. By default, it's just "DMS_MilitaryVehicles" and "DMS_TransportTrucks".
//"Exile_Car_Offroad_Armed_Guerilla01"
] + DMS_MilitaryVehicles + DMS_TransportTrucks;
/* Loot Settings */

View File

@ -171,57 +171,44 @@ DMS_MinMax_X_Coords = [DMS_MinDistFromWestBorder, worldSize - DMS_MinDistFromEas
DMS_MinMax_Y_Coords = [DMS_MinDistFromSouthBorder, worldSize - DMS_MinDistFromNorthBorder];
execFSM "\x\addons\dms\FSM\missions.fsm";
if (DMS_DynamicMission || {DMS_StaticMission}) then
if (DMS_ShowDifficultyColorLegend) then
{
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\static_init.sqf";
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\mission_init.sqf";
if (DMS_ShowDifficultyColorLegend) then
private "_title";
_title = createmarker ["DMS_MissionMarker_DifficultyColorLegend",[-500,-200]];
_title setMarkerColor "ColorRed";
_title setmarkertext "DMS Mission Difficulties Color Legend";
_title setMarkerType "mil_dot";
_title setMarkerAlpha 0.5;
{
private "_title";
_title = createmarker ["DMS_MissionMarker_DifficultyColorLegend",[-500,-200]];
_title setMarkerColor "ColorRed";
_title setmarkertext "DMS Mission Difficulties Color Legend";
_title setMarkerType "mil_dot";
_title setMarkerAlpha 0.5;
private ["_difficulty", "_color", "_num", "_pos", "_circle", "_dot"];
_difficulty = _x;
switch (_difficulty) do
{
private ["_difficulty", "_color", "_num", "_pos", "_circle", "_dot"];
case "easy": {_color = "ColorGreen";};
case "moderate": {_color = "ColorYellow";};
case "difficult": {_color = "ColorRed";};
case "hardcore" : {_color = "ColorBlack";};
};
_difficulty = _x;
switch (_difficulty) do
{
case "easy": {_color = "ColorGreen";};
case "moderate": {_color = "ColorYellow";};
case "difficult": {_color = "ColorRed";};
case "hardcore" : {_color = "ColorBlack";};
};
_num = -200 * (_forEachIndex - 0.5);
_pos = [100,_num];
_num = -200 * (_forEachIndex - 0.5);
_pos = [100,_num];
_circle = createMarker [format ["DMS_MissionMarker_DifficultyColor_%1",_color], _pos];
_circle setMarkerColor _color;
_circle setMarkerShape "ELLIPSE";
_circle setMarkerBrush "Solid";
_circle setMarkerSize [100,100];
_circle = createMarker [format ["DMS_MissionMarker_DifficultyColor_%1",_color], _pos];
_circle setMarkerColor _color;
_circle setMarkerShape "ELLIPSE";
_circle setMarkerBrush "Solid";
_circle setMarkerSize [100,100];
_dot = createMarker [format ["DMS_MissionMarker_Difficulty_%1",_difficulty],_pos];
_dot setMarkerColor "ColorWhite";
_dot setMarkerType "mil_dot";
_dot setMarkerAlpha 0.5;
_dot setMarkerText _difficulty;
} forEach ["hardcore","difficult","moderate","easy"];
};
execFSM "\x\addons\dms\FSM\missions.fsm";
}
else
{
diag_log "Enjoy DMS functions! :)";
_dot = createMarker [format ["DMS_MissionMarker_Difficulty_%1",_difficulty],_pos];
_dot setMarkerColor "ColorWhite";
_dot setMarkerType "mil_dot";
_dot setMarkerAlpha 0.5;
_dot setMarkerText _difficulty;
} forEach ["hardcore","difficult","moderate","easy"];
};

View File

@ -104,3 +104,8 @@ DMS_fnc_setRelPositions =
DMS_MaxSurfaceNormal = DMS_MinSurfaceNormal;
DMS_AttemptsUntilThrottle = DMS_AttemptsUntilThrottle + 1;
// Initialize mission variables...
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\static_init.sqf";
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\mission_init.sqf";

View File

@ -60,7 +60,7 @@ _group =
_class =
if (_extraParams isEqualTo []) then
{
(DMS_MilitaryVehicles+DMS_TransportTrucks) call BIS_fnc_SelectRandom
DMS_CarThievesVehicles call BIS_fnc_SelectRandom
}
else
{
@ -76,7 +76,7 @@ _class =
}
else
{
(DMS_MilitaryVehicles+DMS_TransportTrucks) call BIS_fnc_SelectRandom
DMS_CarThievesVehicles call BIS_fnc_SelectRandom
};
};
};
@ -165,7 +165,7 @@ if !(_added) exitWith
} forEach _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
{
_cleanup pushBack (_x select 0);
} foreach (_missionObjs select 2);
@ -190,4 +190,4 @@ if !(_added) exitWith
if (DMS_DEBUG) then
{
(format ["MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time]) call DMS_fnc_DebugLog;
};
};

View File

@ -23,8 +23,18 @@ if (DMS_DEBUG) then
// Set mission frequencies from config
DMS_BanditMissionTypesArray = [];
{
private "_missionName";
_missionName = _x select 0;
for "_i" from 1 to (_x select 1) do
{
DMS_BanditMissionTypesArray pushBack (_x select 0);
DMS_BanditMissionTypesArray pushBack _missionName;
};
} forEach DMS_BanditMissionTypes;
missionNamespace setVariable
[
format["DMS_Mission_%1",_missionName],
compileFinal preprocessFileLineNumbers (format ["\x\addons\DMS\missions\bandit\%1.sqf",_missionName])
];
} forEach DMS_BanditMissionTypes;

View File

@ -22,8 +22,18 @@ if (DMS_DEBUG) then
// Set mission frequencies from config
DMS_StaticMissionTypesArray = [];
{
private "_missionName";
_missionName = _x select 0;
for "_i" from 1 to (_x select 1) do
{
DMS_StaticMissionTypesArray pushBack (_x select 0);
DMS_StaticMissionTypesArray pushBack _missionName;
};
} forEach DMS_StaticMissionTypes;
missionNamespace setVariable
[
format["DMS_StaticMission_%1",_missionName],
compileFinal preprocessFileLineNumbers (format ["\x\addons\DMS\missions\static\%1.sqf",_missionName])
];
} forEach DMS_StaticMissionTypes;

View File

@ -47,7 +47,7 @@
_missionEvents,
[
_onSuccessScripts, // (OPTIONAL) Array of code or string to be executed on mission completion (in addition to regular code). Each element should be an array in the form [_params, _code].
_onFailScripts, // (OPTIONAL) Array of code or stirng to be executed on mission failure (in addition to regular code). Each element should be an array in the form [_params, _code].
_onFailScripts, // (OPTIONAL) Array of code or string to be executed on mission failure (in addition to regular code). Each element should be an array in the form [_params, _code].
_onMonitorStart, // (OPTIONAL) Code to run when the monitor starts to check the mission status. The passed parameter (_this) is the mission data array itself.
_onMonitorEnd // (OPTIONAL) Code to run when the monitor is done with checking the mission status. The passed parameter (_this) is the mission data array itself.
]

View File

@ -57,7 +57,7 @@
_missionEvents,
[
_onSuccessScripts, // (OPTIONAL) Array of code or string to be executed on mission completion (in addition to regular code). Each element should be an array in the form [_params, _code].
_onFailScripts, // (OPTIONAL) Array of code or stirng to be executed on mission failure (in addition to regular code). Each element should be an array in the form [_params, _code].
_onFailScripts, // (OPTIONAL) Array of code or string to be executed on mission failure (in addition to regular code). Each element should be an array in the form [_params, _code].
_onMonitorStart, // (OPTIONAL) Code to run when the monitor starts to check the mission status. The passed parameter (_this) is the mission data array itself.
_onMonitorEnd // (OPTIONAL) Code to run when the monitor is done with checking the mission status. The passed parameter (_this) is the mission data array itself.
]

View File

@ -104,13 +104,13 @@ exitWith
_crate hideObjectGlobal false;
if !(DMS_GodmodeCrates) then
if !(_crate getVariable ["DMS_CrateGodMode",DMS_GodmodeCrates]) then
{
_crate allowDamage true;
};
_crate enableSimulationGlobal true;
if (DMS_EnableBoxMoving) then
if (_crate getVariable ["DMS_CrateEnableRope",DMS_EnableBoxMoving]) then
{
_crate enableRopeAttach true;
};

View File

@ -164,7 +164,7 @@ if (DMS_StaticMission_Arr isEqualTo []) exitWith {}; // Empty array, no stati
// Check to see if the timeout should be extended before ending the mission.
if ((DMS_StaticMissionTimeoutResetRange>0) && {[_missionPos,DMS_StaticMissionTimeoutResetRange] call DMS_fnc_IsPlayerNearby}) then
{
_x set [2,[diag_tickTime,_failTime]];
_x set [3,[diag_tickTime,_failTime]];
throw format ["Mission Timeout Extended at %1 with timeout after %2 seconds. Position: %3",diag_tickTime,_failTime,_missionPos];
};
@ -208,7 +208,7 @@ if (DMS_StaticMission_Arr isEqualTo []) exitWith {}; // Empty array, no stati
{
if ((DMS_StaticMissionTimeoutResetRange>0) && {[_missionPos,DMS_StaticMissionTimeoutResetRange] call DMS_fnc_IsPlayerNearby}) then
{
_x set [2,[diag_tickTime,_failTime]];
_x set [3,[diag_tickTime,_failTime]];
if (DMS_DEBUG) then
{

View File

@ -31,6 +31,8 @@ _launcher = secondaryWeapon _unit;
_launcherVar = _unit getVariable ["DMS_AI_Launcher",""];
_playerObj = objNull;
_unit call ([missionNamespace getVariable [_unit getVariable ["DMS_AI_CustomOnKilledFnc",""],{}]] param [0,{},[{}]]);
// Some of the previously used functions work with non-local argument. Some don't. BIS is annoying
_removeAll =
{
@ -288,6 +290,8 @@ if (isPlayer _killer) then
};
};
_unit setVariable ["DMS_KillerID",owner _playerObj];
// Reveal the killer to the AI units
if (DMS_ai_share_info) then
@ -321,3 +325,4 @@ if (isPlayer _killer) then
// Let Exile handle the AI Body cleanup.
_unit setVariable ["ExileDiedAt",time];
_unit setVariable ["DMS_KillerObj",[_playerObj,_killer] select (isNull _playerObj)];

View File

@ -16,7 +16,7 @@
Returns nothing
*/
private ["_playerUID", "_playerObj", "_moneyChange", "_AISide", "_AIType", "_repChange", "_roadKilled", "_unitMoney", "_unit", "_unitRespect", "_playerMoney", "_playerRespect", "_msgType", "_msgParams"];
private ["_playerUID", "_playerObj", "_moneyChange", "_AISide", "_AIType", "_repChange", "_roadKilled", "_unitMoney", "_unit", "_unitRespect", "_playerMoney", "_playerRespect", "_unitName", "_msgType", "_msgParams"];
if !(params
[
@ -62,10 +62,11 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
};
if ((_moneyChange!=0) || (_repChange!=0)) then
if ((_moneyChange!=0) || {_repChange!=0}) then
{
_playerMoney = _playerObj getVariable ["ExileMoney", 0];
_playerRespect = _playerObj getVariable ["ExileScore", 0];
_unitName = name _unit;
/*
if (DMS_DEBUG) then
@ -84,7 +85,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
_playerObj setVariable ["ExileMoney",_playerMoney];
_msgType = "moneyReceivedRequest";
_msgParams = [str _playerMoney, format ["killing a %1 AI",_AIType]];
_msgParams = [str _playerMoney, format ["killed %1",_unitName]];
if (_moneyChange<0) then
{
@ -117,7 +118,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (_repChange!=0) then
{
_attributes = [[format ["%1 AI KILL",toUpper _AIType],_repChange]];
_attributes = [[format ["KILLED %1",toUpper(_unitName)],_repChange]];
if (DMS_AIKill_DistanceBonusCoefficient>0) then
{
@ -168,7 +169,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
[
"%1 killed %2 from %3 meters away and received %4 poptabs and %5 respect.",
name _playerObj,
name _unit,
_unitName,
if !(isNil "_distance") then {_distance} else {floor(_unit distance _playerObj)},
_moneyChange,
_repChange

View File

@ -20,9 +20,10 @@ if ((count DMS_RunningStaticMissions) >= DMS_MaxStaticMissions) then
};
if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}) then
{
if (_time - DMS_BMissionLastStart > DMS_BMissionDelay) then
if (DMS_DynamicMission && {_time - DMS_BMissionLastStart > DMS_BMissionDelay}) then
{
private "_mission";
_mission = DMS_BanditMissionTypesArray call BIS_fnc_selectRandom;
@ -41,7 +42,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount})
};
if ((DMS_StaticMission) && {_time - DMS_StaticMissionLastStart > DMS_StaticMissionDelay}) then
if (DMS_StaticMission && {_time - DMS_StaticMissionLastStart > DMS_StaticMissionDelay}) then
{
private ["_mission", "_availableMissions"];
@ -70,4 +71,4 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount})
(format ["SelectMission :: Spawning of static mission ""%1"" complete!", _mission]) call DMS_fnc_DebugLog;
};
};
};
};

View File

@ -12,12 +12,20 @@
*/
private ["_missionType", "_parameters"];
private ["_mission", "_parameters"];
_missionType = param [0, DMS_BanditMissionTypesArray call BIS_fnc_selectRandom, [""]];
if !(_missionType in DMS_BanditMissionTypesArray) then
_mission =
[
missionNamespace getVariable format
[
"DMS_Mission_%1",
_this param [0, DMS_BanditMissionTypesArray call BIS_fnc_selectRandom, [""]]
]
] param [0, "no",[{}]];
if (_mission isEqualTo "no") then
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnBanditMission for a mission that isn't in DMS_BanditMissionTypesArray! Parameters: %1",_this];
}
@ -29,7 +37,7 @@ else
DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1;
DMS_BMissionDelay = DMS_TimeBetweenMissions call DMS_fnc_SelectRandomVal;
_parameters call compile preprocessFileLineNumbers (format ["\x\addons\DMS\missions\bandit\%1.sqf",_missionType]);
_parameters call _mission;
DMS_BMissionLastStart = diag_tickTime;
@ -38,4 +46,4 @@ else
{
(format ["SpawnBanditMission :: Spawned mission %1 with parameters (%2) | DMS_BMissionDelay set to %3 seconds", _missionType, _parameters, DMS_BMissionDelay]) call DMS_fnc_DebugLog;
};
};
};

View File

@ -14,14 +14,23 @@
*/
private ["_missionType", "_parameters", "_return"];
private ["_missionType", "_mission", "_parameters", "_return"];
_missionType = param [0, DMS_StaticMissionTypesArray call BIS_fnc_selectRandom, [""]];
_mission =
[
missionNamespace getVariable format
[
"DMS_StaticMission_%1",
_missionType
]
] param [0, "no", [{}]];
try
{
if !(_missionType in DMS_StaticMissionTypesArray) then
if (_mission isEqualTo "no") then
{
throw format ["for a mission that isn't in DMS_StaticMissionTypesArray! Parameters: %1",_this];
};
@ -36,7 +45,7 @@ try
DMS_MissionCount = DMS_MissionCount + 1;
_return = _parameters call compile preprocessFileLineNumbers (format ["\x\addons\DMS\missions\static\%1.sqf",_missionType]);
_return = _parameters call _mission;
if ((!isNil "_return") && {_return isEqualTo "delay"}) exitWith
{
@ -62,4 +71,4 @@ try
catch
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnStaticMission %1", _exception];
};
};

View File

@ -143,6 +143,7 @@ ___
DMS_BoxBaseParts
DMS_BoxCraftingMaterials
DMS_BoxTools
DMS_CarThievesVehicles
* **UPDATING THE MISSIONS "bauhaus" AND "construction" ARE HIGHLY RECOMMENDED.**
* Created a couple new config examples.
* DMS will now use its own "PUID" for spawning persistent vehicles (instead of mine).
@ -169,6 +170,11 @@ ___
* Loot configs for Survival Supplies and Construction Supplies have been split up and made more modular so they're easier to configure.
* The "bauhaus" mission is now actually guaranteed to spawn construction supplies.
* The "construction" mission spawns a greater variety and quantity of building supplies (and the supplies aren't hardcoded).
* Moved static and dynamic mission variable initialization to pre-init.
* Missions are now compiled in pre-init to limit overhead in runtime.
* You can now ```setVariable "DMS_CrateGodMode"``` and ```"DMS_CrateEnableRope"``` on a crate to control the respective settings.
* Fixed a typo that caused a script error in static mission monitor and prevented group reinforcements from spawning.
* You can now ```setVariable "DMS_AI_CustomOnKilledFnc"``` (a string) to execute a function on death. The dead unit is passed.