Important restructuring, minor fix(es)

* CONFIG VALUES: Changed "DMS_MissionTypes" to "DMS_BanditMissionTypes"
* Renamed some variables to "future-proof" them
* Placed all current missions under "bandit" subfolder to for easier
future integration.
* Created function "DMS_fnc_SpawnBanditMission" to handle bandit mission
spawning (makes it easier to spawn missions via admin console).
* Attached vehicle eventhandlers to DMS-spawned non-persistent vehicles.
* Fixed the "lock" option appearing on DMS-spawned vehicles.
This commit is contained in:
eraser1 2015-09-20 23:42:33 -05:00
parent 37ae9e2a05
commit 7a074042b1
28 changed files with 92 additions and 30 deletions

View File

@ -58,6 +58,7 @@ class CfgFunctions
class SpawnAIVehicle {};
class SpawnAISoldier {};
class SpawnAIStatic {};
class SpawnBanditMission {};
class SpawnCrate {};
class SpawnNonPersistentVehicle {};
class TargetsKilled {};

View File

@ -75,7 +75,7 @@ DMS_DEBUG = false;
DMS_dynamicText_Color = "#FFCC00"; // Dynamic Text color for "dynamicTextRequest" notification type.
/*Mission notification settings*/
DMS_MissionTypes = [ // List of missions with spawn chances. If they add up to 100%, they represent the percentage chance each one will spawn
DMS_BanditMissionTypes = [ // List of missions with spawn chances. If they add up to 100%, they represent the percentage chance each one will spawn
["bandits",25],
["bauhaus",25],
["beertransport",15],
@ -597,7 +597,7 @@ if(DMS_DEBUG) then
{
DMS_TimeBetweenMissions = [10,15];
DMS_MissionTimeOut = [60,70];
DMS_MissionTypes = [["testmission",1]];
//DMS_MissionTypes = [["mercbase",1]];
//DMS_BanditMissionTypes = [["testmission",1]];
//DMS_BanditMissionTypes = [["mercbase",1]];
diag_log format ["DMS_DEBUG CONFIG :: Overriding DMS_TimeBetweenMissions (%1) and DMS_MissionTimeOut (%2)",DMS_TimeBetweenMissions,DMS_MissionTimeOut];
};

View File

@ -66,13 +66,13 @@ _missionObjs =
];
// Define Mission Start message
_msgStart = format["<t color='#FFFF00' size='1.25'>Humantarian Supplies! </t><br/> A truck carrying humanitarian supplies has been sized by bandits, stop them!"];
_msgStart = format["<t color='#FFFF00' size='1.25'>Humanitarian Supplies! </t><br/> A truck carrying humanitarian supplies has been sized by bandits, stop them!"];
// Define Mission Win message
_msgWIN = format["<t color='#0080ff' size='1.25'>Humantarian Supplies! </t><br/> Convicts have successfully claimed the humanitarian supplies for themselves!"];
_msgWIN = format["<t color='#0080ff' size='1.25'>Humanitarian Supplies! </t><br/> Convicts have successfully claimed the humanitarian supplies for themselves!"];
// Define Mission Lose message
_msgLOSE = format["<t color='#FF0000' size='1.25'>Humantarian Supplies! </t><br/> The bandits have taken the humanitarian supplies and escaped!"];
_msgLOSE = format["<t color='#FF0000' size='1.25'>Humanitarian Supplies! </t><br/> The bandits have taken the humanitarian supplies and escaped!"];
// Define mission name (for map marker and logging)
_missionName = "Humanitarian Supplies";

View File

@ -22,10 +22,10 @@ if (DMS_DEBUG) then
};
// Set mission frequencies from config
DMS_MissionTypesArray = [];
DMS_BanditMissionTypesArray = [];
{
for "_i" from 1 to (_x select 1) do
{
DMS_MissionTypesArray pushBack (_x select 0);
DMS_BanditMissionTypesArray pushBack (_x select 0);
};
} forEach DMS_MissionTypes;
} forEach DMS_BanditMissionTypes;

View File

@ -36,7 +36,7 @@ _i = 0;
while{!_validspot} do
{
_pos = _safePosParams call BIS_fnc_findSafePos;
_i = _i+1;
_i = _i+1;
try
{
// Check for nearby water
@ -51,9 +51,9 @@ while{!_validspot} do
throw ("players");
};
// Terrain steepness check
if (((surfaceNormal _pos) select 2)<DMS_MaxSurfaceNormal) then
{
diag_log format ["%1 is too steep.",_pos];
throw ("a steep location");
};

View File

@ -64,7 +64,7 @@ private ["_pos", "_success", "_timeStarted", "_timeUntilFail", "_units", "_build
_arr = DMS_Mission_Arr deleteAt _forEachIndex;
{
_x lock 0;
_x lock 1;
_x allowDamage true;
_x enableRopeAttach true;
_x enableSimulationGlobal true;

View File

@ -9,27 +9,19 @@ private "_time";
_time = diag_tickTime;
if (DMS_RunningBMissionCount isEqualTo DMS_MaxBanditMissions) then
if (DMS_RunningBMissionCount >= DMS_MaxBanditMissions) then
{
DMS_BMissionLastStart = _time;
};
if ((_time - DMS_BMissionLastStart > DMS_BMissionDelay) && {diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}}) then
if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}) then
{
private "_mission";
DMS_MissionCount = DMS_MissionCount + 1;
DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1;
DMS_BMissionLastStart = _time;
_mission = DMS_MissionTypesArray call BIS_fnc_selectRandom;
DMS_BMissionDelay = DMS_TimeBetweenMissions call DMS_fnc_SelectRandomVal;
if (DMS_DEBUG) then
// More Mission types coming soon
if (_time - DMS_BMissionLastStart > DMS_BMissionDelay) then
{
diag_log format ["DMS_DEBUG SelectMission :: Spawning mission: %1 | DMS_BMissionDelay set to %2",_mission,DMS_BMissionDelay];
};
private "_mission";
_mission = DMS_BanditMissionTypesArray call BIS_fnc_selectRandom;
call compile preprocessFileLineNumbers (format ["\x\addons\DMS\missions\%1.sqf",_mission]);
[_mission] call DMS_fnc_SpawnBanditMission;
};
};

View File

@ -0,0 +1,46 @@
/*
DMS_fnc_SpawnBanditMission
Created by eraser1
Usage:
[
_missionType,
_parameters
] call DMS_fnc_SpawnBanditMission;
Simply spawns a mission with the given mission type and passes parameters to it. Returns nothing
*/
private ["_OK", "_missionType", "_parameters"];
_missionType = param [0, DMS_BanditMissionTypesArray call BIS_fnc_selectRandom, [""]];
if !(_missionType in DMS_BanditMissionTypesArray) then
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnBanditMission for a mission that isn't in DMS_BanditMissionTypesArray! Parameters: %1",_this];
}
else
{
_parameters = [];
if ((count _this)>1) then
{
_parameters = _this select 1;
};
DMS_MissionCount = DMS_MissionCount + 1;
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]);
DMS_BMissionLastStart = diag_tickTime;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SelectMission :: Spawned mission %1 with parameters (%2) | DMS_BMissionDelay set to %3 seconds",str _missionType,_parameters,DMS_BMissionDelay];
};
};

View File

@ -50,13 +50,27 @@ clearItemCargoGlobal _vehObj;
clearMagazineCargoGlobal _vehObj;
clearWeaponCargoGlobal _vehObj;
_vehObj setVariable ["ExileIsPersistent", false];
_vehObj setFuel (0.75+(random 0.25));
_vehObj setDir (random 360);
_vehObj setPosATL _vehpos;
_vehObj setVectorUp (surfaceNormal _vehpos);
_vehObj setVariable ["ExileIsPersistent", false];
_vehObj addEventHandler ["GetIn", { _this call ExileServer_object_vehicle_event_onGetIn}];
if (_vehObj isKindOf "Helicopter") then
{
_vehObj addEventHandler ["RopeAttach",
{
private "_vehicle";
_vehicle = _this select 2;
if !(simulationEnabled _vehicle) then
{
_vehicle enableSimulationGlobal true;
};
}];
};
if (!isNil "RS_VLS") then
{
[_vehicle] call RS_VLS_sanitizeVehicle;

Binary file not shown.

View File

@ -78,6 +78,15 @@ if (!hasInterface && !isServer) then
## Changelog:
#### September 20, 2015 (11:30 PM CST-America):
* CONFIG VALUES: Changed "DMS_MissionTypes" to "DMS_BanditMissionTypes"
* Renamed some variables to "future-proof" them
* Placed all current missions under "bandit" subfolder to for easier future integration.
* Created function "DMS_fnc_SpawnBanditMission" to handle bandit mission spawning (makes it easier to spawn missions via admin console).
* Attached vehicle eventhandlers to DMS-spawned non-persistent vehicles.
* Fixed the "lock" option appearing on DMS-spawned vehicles.
#### September 20, 2015 (3:30 PM CST-America):
* NEW CONFIG VALUE: "DMS_MaxSurfaceNormal"
* The above config value now determines the maximum incline that a mission can spawn on. Default value is 0.95, which should be sufficiently flat.