DMS_Exile/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf
eraser1 70fae7bc44 Merry Xmas :D
* **NEW CONFIG VALUES:**

DMS_SpawnFlareOnReinforcements
DMS_MissionMarkerWinDot_Type
DMS_MissionMarkerLoseDot_Type
DMS_EnableBoxMoving
DMS_BasesToImportOnServerStart
DMS_AI_Classname
DMS_AI_AimCoef_easy
DMS_AI_AimCoef_moderate
DMS_AI_AimCoef_difficult
DMS_AI_AimCoef_hardcore
DMS_AI_EnableStamina_easy
DMS_AI_EnableStamina_moderate
DMS_AI_EnableStamina_difficult
DMS_AI_EnableStamina_hardcore
DMS_AI_destroyStaticWeapon
DMS_AI_destroyStaticWeapon_chance
DMS_ai_SupportedRandomClasses
DMS_random_non_assault_AI
DMS_random_non_MG_AI
DMS_random_non_sniper_AI
* Please check out the new config values in config.sqf to see what they
do :)
* Fixed issue with "thieves" mission (and DMS-spawned persistent
vehicles in general). Big thank you to [JamieKG from Eternal
Gamer](http://eternal-gamer.com/) and Torndeco.
* **New static mission: "slums"**
* Credit for the base goes to [William from Refugees of the
Fallen](http://refugeesofthefallen.enjin.com/)
* Spawns 2 crates at 2 different locations from a list of 5 locations.
* No AI vehicles, only infantry (introduces Close Quarters Combat)
* Added to Altis by default.
* Static bases can now be imported on server startup instead of mission
spawns. Enabled by default for saltflats and slums.
* Increased "DMS_MissionTimeoutResetRange" from 1000 to 1500.
* Removed the Navid from config (MG AI and box weapons).
* Edited panthera3_config to reduce SpawnZoneNear and TraderZoneNear
blacklists.
* Edited "blackhawkdown" and "donthasslethehoff" missions to use a
slightly different heli wreck classname.
* Increased marker circle diameter for saltflats mission to 750 meters.
* Moved "DMS_Version" variable assignment to pre-init.
* Moved Map Center and Map Radius assignments to post-init.
* Added support for 2 new optional parameters: _onMonitorStart and
_onMonitorEnd, run before and after the Mission Monitor checks the
mission, but AFTER "Mission Success State" is checked.
* Mines should now be deleted when a mission fails.
* Script optimizations for almost all functions using new command(s)
introduced in ArmA v1.54, as well as improved technique(s).
* "ExileServer_system_garbageCollector_deleteObject" is now used to
actually delete items by DMS_fnc_CleanUp.
* AI and vehicle cleanup should now be completely handled by Exile.
* Added support for mARMA logging.
* **You can now disable the movement/lifting of loot crates after the
mission is complete using "DMS_EnableBoxMoving".**
* Added some debug code to DMS_fnc_FindSafePos and
DMS_fnc_IsValidPosition (commented out by default)
* New group reinforcement type "increasing_difficulty".
* DMS_fnc_IsNearWater now checks for invalid parameter(s).
* DMS_fnc_PlayerAwardOnAIKill now checks for roadkill values AFTER
unit-defined respect/tabs.
* You can now define different marker types for mission
completion/failure using "DMS_MissionMarkerWinDot_Type" and
"DMS_MissionMarkerLoseDot_Type" respectively.
* "DMS_fnc_SetGroupBehavior" can now take a unit as parameter as well.
It will also now return true if behavior was changed, false otherwise.
* "DMS_fnc_SpawnAIGroup" and "DMS_fnc_SpawnAIGroup_MultiPos" now
supports the definition of custom gear sets.
* Improved function documentation for "DMS_fnc_SpawnAIGroup",
"DMS_fnc_SpawnAIGroup_MultiPos", and "DMS_fnc_SpawnAISoldier".
* "DMS_fnc_SpawnAISoldier" now supports multiple different random AI
class presets. This means that you can define a certain "random" class
preset, but have it select from a specially defined list that excludes
classes that you don't want.
* Added default values to certain "missionNameSpace getVariable"s in
DMS_fnc_SpawnAISoldier to prevent script errors in the event of invalid
definitions.
* Slight logic tweak/fix to DMS_fnc_TargetsKilled (it shouldn't throw
errors when there aren't any).
2015-12-24 13:45:20 -06:00

231 lines
6.0 KiB
Plaintext

/*
DMS post-init
Created by eraser1 and Defent
*/
if !(isServer) exitWith
{
for "_i" from 0 to 99 do
{
diag_log "The DMS PBO is for the SERVER ONLY. It will NOT work for any form of client! DMS launch cancelled.";
};
};
if (isNil "DMS_DynamicMission") exitWith
{
for "_i" from 0 to 99 do
{
diag_log "DMS ERROR :: You have made an error in your DMS config.sqf! Cancelling DMS Launch.";
};
};
// This code is NECESSARY for spawning persistent vehicles. DO NOT REMOVE THIS CODE UNLESS YOU KNOW WHAT YOU ARE DOING
if !("isKnownAccount:76561198027700602" call ExileServer_system_database_query_selectSingleField) then
{
"createAccount:76561198027700602:eraser1" call ExileServer_system_database_query_fireAndForget;
};
// Some custom maps don't have the proper safePos config entries.
// If you are using one and you have an issue with mission spawns, please create an issue on GitHub or post a comment in the DMS thread.
switch (toLower worldName) do
{
case "altis": // [16000,16000] w/ radius of 16000 works well for Altis
{
DMS_MapCenterPos = [16000,16000];
DMS_MapRadius = 16000;
};
case "bornholm": // Thanks to thirdhero for testing this info
{
DMS_MapCenterPos = [11265,11265];
DMS_MapRadius = 12000;
};
case "esseker": // Thanks to Flowrider for this info
{
DMS_MapCenterPos = [6275,6350];
DMS_MapRadius = 5000;
};
case "tavi": // Thanks to JamieKG for this info
{
DMS_MapCenterPos = [12800,12800];
DMS_MapRadius = 12800;
};
default // Use "worldSize" to determine map center/radius (not always very nice).
{
private "_middle";
_middle = worldSize/2;
DMS_MapCenterPos = [_middle,_middle];
DMS_MapRadius = _middle;
};
};
// Since we use primarily ATL
DMS_MapCenterPos set [2,0];
RESISTANCE setFriend[WEST,0];
WEST setFriend[RESISTANCE,0];
RESISTANCE setFriend[EAST,0];
EAST setFriend[RESISTANCE,0];
EAST setFriend[WEST,0];
WEST setFriend[EAST,0];
if ((!isNil "A3XAI_isActive") && {!DMS_ai_offload_Only_DMS_AI}) then
{
diag_log 'DMS DETECTED A3XAI. Enabling "DMS_ai_offload_Only_DMS_AI"!';
DMS_ai_offload_Only_DMS_AI = true;
};
if ((isClass (configFile >> "CfgPatches" >> "Ryanzombies")) && {!DMS_ai_offload_Only_DMS_AI}) then
{
diag_log 'DMS DETECTED RyanZombies. Enabling "DMS_ai_offload_Only_DMS_AI"!';
DMS_ai_offload_Only_DMS_AI = true;
};
DMS_A3_AllMarkerColors = [];
for "_i" from 0 to ((count(configfile >> "CfgMarkerColors"))-1) do
{
DMS_A3_AllMarkerColors pushBack (toLower (configName ((configfile >> "CfgMarkerColors") select _i)));
};
if !((toLower DMS_MissionMarkerWinDotColor) in DMS_A3_AllMarkerColors) then
{
diag_log format ["DMS ERROR :: Unsupported color for DMS_MissionMarkerWinDotColor (""%1""). Switching color to ""ColorBlue"".",DMS_MissionMarkerWinDotColor];
DMS_MissionMarkerWinDotColor = "ColorBlue";
};
if !((toLower DMS_MissionMarkerLoseDotColor) in DMS_A3_AllMarkerColors) then
{
diag_log format ["DMS ERROR :: Unsupported color for DMS_MissionMarkerLoseDotColor (""%1""). Switching color to ""ColorRed"".",DMS_MissionMarkerLoseDotColor];
DMS_MissionMarkerLoseDotColor = "ColorRed";
};
// Create and send Client Functions using compileFinal for security.
DMS_CLIENT_fnc_spawnDynamicText = compileFinal
("
[
_this,
0,
safeZoneY,
"+str DMS_dynamicText_Duration+",
"+str DMS_dynamicText_FadeTime+",
0,
24358
] spawn BIS_fnc_dynamicText;
");
publicVariable "DMS_CLIENT_fnc_spawnDynamicText";
DMS_CLIENT_fnc_spawnTextTiles = compileFinal
("
[
parseText _this,
[
0,
safeZoneY,
1,
1
],
[10,10],
"+str DMS_textTiles_Duration+",
"+str DMS_textTiles_FadeTime+",
0
] spawn BIS_fnc_textTiles;
");
publicVariable "DMS_CLIENT_fnc_spawnTextTiles";
// Add the weighted predefined locations to the list of predefined locations
{
for "_i" from 1 to (_x select 1) do
{
DMS_PredefinedMissionLocations pushBack (_x select 0);
};
} forEach DMS_PredefinedMissionLocations_WEIGHTED;
// Set up the minimum/maximum co-ordinate values for x and y...
DMS_MinMax_X_Coords = [DMS_MinDistFromWestBorder, worldSize - DMS_MinDistFromEastBorder];
DMS_MinMax_Y_Coords = [DMS_MinDistFromSouthBorder, worldSize - DMS_MinDistFromNorthBorder];
if (DMS_DynamicMission || {DMS_StaticMission}) 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 ["_difficulty", "_color", "_num", "_pos", "_circle", "_dot"];
_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];
_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! :)";
};
{
[_x] call DMS_fnc_ImportFromM3E_Static; // Spawn all of the bases that are supposed to be spawned on server startup.
} forEach DMS_BasesToImportOnServerStart;
format ["DMS post-init complete. productVersion: %1 | infiSTAR version: %2", productVersion, if (!isNil "INFISTARVERSION") then {INFISTARVERSION} else {"not installed"}] call DMS_fnc_DebugLog;