Advertisement
Guest User

init

a guest
Jun 22nd, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 KB | None | 0 0
  1. /*
  2. DZMSInit.sqf by Vampire
  3. This is the file that every other file branches off from.
  4. It checks that it is safe to run, sets relations, and starts mission timers.
  5. */
  6. private["_modVariant"];
  7.  
  8. waitUntil{initialized};
  9.  
  10. // Lets let the heavier scripts run first
  11. sleep 60;
  12.  
  13. // Error Check
  14. if (!isServer) exitWith { diag_log text format ["[DZMS]: <ERROR> DZMS is Installed Incorrectly! DZMS is not Running!"]; };
  15. if (!isnil("DZMSInstalled")) exitWith { diag_log text format ["[DZMS]: <ERROR> DZMS is Installed Twice or Installed Incorrectly!"]; };
  16.  
  17. // Global for other scripts to check if DZMS is installed.
  18. DZMSInstalled = true;
  19.  
  20. diag_log text format ["[DZMS]: Starting DayZ Mission System."];
  21.  
  22. // Let's see if we need to set relationships
  23. // Checking for DayZAI, SargeAI, and WickedAI (Three AI Systems that already set relations)
  24. // I would rather the user set their relations in the respective mod instead of overwrite them here.
  25. if ( (isnil("DZAI_isActive")) && (isnil("SAR_version")) && (isnil("WAIconfigloaded")) ) then
  26. {
  27.  
  28. // They weren't found, so let's set relationships
  29. diag_log text format ["[DZMS]: Relations not found! Using DZMS Relations."];
  30.  
  31. // Create the groups if they aren't created already
  32. createCenter east;
  33. // Make AI Hostile to Survivors
  34. WEST setFriend [EAST,0];
  35. EAST setFriend [WEST,0];
  36. // Make AI Hostile to Zeds
  37. EAST setFriend [CIVILIAN,0];
  38. CIVILIAN setFriend [EAST,0];
  39.  
  40. } else {
  41.  
  42. // Let's inform the user which relations we are using
  43. // This could be made better in a future version
  44. DZMSRelations = 0; //Set our counter variable
  45. if (!isnil("DZAI_isActive")) then {
  46. diag_log text format ["[DZMS]: DZAI Found! Using DZAI's Relations!"];
  47. DZMSRelations = DZMSRelations + 1;
  48. };
  49. if (!isnil("SAR_version")) then {
  50. diag_log text format ["[DZMS]: SargeAI Found! Using SargeAI's Relations!"];
  51. DZMSRelations = DZMSRelations + 1;
  52. };
  53. if (!isnil("WAIconfigloaded")) then {
  54. diag_log text format ["[DZMS]: WickedAI Found! Using WickedAI's Relations!"];
  55. DZMSRelations = DZMSRelations + 1;
  56. };
  57. // If we have multiple relations running, lets warn the user
  58. if (DZMSRelations > 1) then {
  59. diag_log text format ["[DZMS]: Multiple Relations Detected! Unwanted AI Behaviour May Occur!"];
  60. diag_log text format ["[DZMS]: If Issues Arise, Decide on a Single AI System! (DayZAI, SargeAI, or WickedAI)"];
  61. };
  62. DZMSRelations = nil; //Destroy the Global Var
  63.  
  64. };
  65.  
  66. // Let's Load the Mission Configuration
  67. call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZMS\DZMSConfig.sqf";
  68.  
  69. // These are Extended configuration files the user can adjust if wanted
  70. call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZMS\ExtConfig\DZMSC130WeaponCrate.sqf";
  71. call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZMS\ExtConfig\DZMSWeaponCrateList.sqf";
  72. call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZMS\ExtConfig\DZMSAIConfig.sqf";
  73.  
  74. // Report the version
  75. diag_log text format ["[DZMS]: Currently Running Version: %1", DZMSVersion];
  76.  
  77. // Lets check for a copy-pasted config file
  78. if (DZMSVersion != "1.1FIN") then {
  79. diag_log text format ["[DZMS]: Outdated Configuration Detected! Please Update DZMS!"];
  80. diag_log text format ["[DZMS]: Old Versions are not supported by the Mod Author!"];
  81. };
  82.  
  83. diag_log text format ["[DZMS]: Mission and Extended Configuration Loaded!"];
  84.  
  85. // Lets get the map name for mission location purposes
  86. DZMSWorldName = toLower format ["%1", worldName];
  87. diag_log text format["[DZMS]: %1 Detected. Map Specific Settings Adjusted!", DZMSWorldName];
  88.  
  89. // We need to detect Epoch to change the hive call for vehicle saving
  90. // Epoch doesn't have hive 999 calls and uses 308 publish instead
  91. _modVariant = toLower( getText (configFile >> "CfgMods" >> "DayZ" >> "dir"));
  92. if (_modVariant == "@dayz_epoch") then {DZMSEpoch = true;} else {DZMSEpoch = false;};
  93. if ((!(DZMSEpoch)) AND (!(isNil "PVDZE_serverObjectMonitor"))) then {DZMSEpoch = true;};
  94.  
  95. if (DZMSEpoch) then {
  96. diag_log text format ["[DZMS]: DayZ Epoch Detected! Some Scripts Adjusted!"];
  97. };
  98.  
  99. // Lets load our functions
  100. call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZMS\DZMSFunctions.sqf";
  101.  
  102. // these arrays are used to hold units for each mission type
  103. DZMSUnitsMinor = [];
  104. DZMSUnitsMajor = [];
  105.  
  106. // Let's get the clocks running!
  107. [] ExecVM DZMSMajTimer;
  108. [] ExecVM DZMSMinTimer;
  109. DZMSMajDone = false;
  110. DZMSMinDone = false;
  111.  
  112. // Let's get the Marker Re-setter running for JIPs to stay updated
  113. [] ExecVM DZMSMarkerLoop;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement