Advertisement
Brenner650

A3XAI_post_init.sqf

Aug 11th, 2019
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 6.65 KB | None | 0 0
  1.  
  2.  
  3. #include "\A3XAI\globaldefines.hpp"
  4.  
  5. /*
  6.     A3XAI Startup
  7.    
  8.     Description: Handles post-initialization tasks
  9.  
  10. */
  11.  
  12. if (A3XAI_debugLevel > 0) then {diag_log "A3XAI Debug: A3XAI Startup is running required script files..."};
  13.  
  14. call compile preprocessFileLineNumbers format ["%1\init\variables.sqf",A3XAI_directory];
  15. call compile preprocessFileLineNumbers format ["%1\init\variables_precalculated.sqf",A3XAI_directory];
  16.  
  17. if (A3XAI_enableHC) then {
  18.     [] call compile preprocessFileLineNumbers format ["%1\init\A3XAI_ServerHC_functions.sqf",A3XAI_directory];
  19.     [] call compile preprocessFileLineNumbers format ["%1\init\A3XAI_ServerHC_PVEH.sqf",A3XAI_directory];
  20.     diag_log "[A3XAI] A3XAI is now listening for headless client connection.";
  21. };
  22.  
  23. //Create default trigger object if AI is spawned without trigger object specified (ie: for custom vehicle AI groups)
  24. _nul = [] spawn {
  25.     A3XAI_defaultTrigger = createTrigger [TRIGGER_OBJECT,[configFile >> "CfgWorlds" >> worldName,"centerPosition",[0,0,0]] call BIS_fnc_returnConfigEntry,false];
  26.     A3XAI_defaultTrigger enableSimulation false;
  27.     A3XAI_defaultTrigger setVariable ["isCleaning",true];
  28.     A3XAI_defaultTrigger setVariable ["patrolDist",100];
  29.     A3XAI_defaultTrigger setVariable ["unitLevel",1];
  30.     A3XAI_defaultTrigger setVariable ["unitLevelEffective",1];
  31.     A3XAI_defaultTrigger setVariable ["locationArray",[]];
  32.     A3XAI_defaultTrigger setVariable ["maxUnits",[0,0]];
  33.     A3XAI_defaultTrigger setVariable ["GroupSize",0];
  34.     A3XAI_defaultTrigger setVariable ["initialized",true];
  35.     A3XAI_defaultTrigger setVariable ["spawnChance",0];
  36.     A3XAI_defaultTrigger setVariable ["spawnType",""];
  37.     A3XAI_defaultTrigger setTriggerText "Default Trigger Object";
  38.     if (A3XAI_debugLevel > 1) then {diag_log format ["A3XAI Debug: Default trigger check result: %1",[!(isNull A3XAI_defaultTrigger),(typeOf A3XAI_defaultTrigger),(getPosASL A3XAI_defaultTrigger)]]};
  39. };
  40.  
  41. [
  42.     //Input variable - Gradechances array, Output variable - Gradeindices array
  43.     ["A3XAI_levelChancesAir","A3XAI_levelIndicesAir"],
  44.     ["A3XAI_levelChancesLand","A3XAI_levelIndicesLand"],
  45.     ["A3XAI_levelChancesUAV","A3XAI_levelIndicesUAV"],
  46.     ["A3XAI_levelChancesUGV","A3XAI_levelIndicesUGV"],
  47.     ["A3XAI_useWeaponChance0","A3XAI_weaponTypeIndices0"],
  48.     ["A3XAI_useWeaponChance1","A3XAI_weaponTypeIndices1"],
  49.     ["A3XAI_useWeaponChance2","A3XAI_weaponTypeIndices2"],
  50.     ["A3XAI_useWeaponChance3","A3XAI_weaponTypeIndices3"]
  51. ] call compile preprocessFileLineNumbers format ["%1\scripts\buildWeightedTables.sqf",A3XAI_directory];
  52.  
  53. if (A3XAI_verifyClassnames) then {
  54.     A3XAI_tableChecklist = ["A3XAI_pistolList0","A3XAI_rifleList0","A3XAI_machinegunList0","A3XAI_sniperList0","A3XAI_pistolList1","A3XAI_rifleList1","A3XAI_machinegunList1","A3XAI_sniperList1",
  55.     "A3XAI_pistolList2","A3XAI_rifleList2","A3XAI_machinegunList2","A3XAI_sniperList2","A3XAI_headgearTypes0","A3XAI_headgearTypes1","A3XAI_headgearTypes2","A3XAI_headgearTypes3",
  56.     "A3XAI_pistolList3","A3XAI_rifleList3","A3XAI_machinegunList3","A3XAI_sniperList3","A3XAI_backpackTypes0","A3XAI_backpackTypes1","A3XAI_backpackTypes2","A3XAI_backpackTypes3",
  57.     "A3XAI_pistolList","A3XAI_rifleList","A3XAI_machinegunList","A3XAI_sniperList","A3XAI_foodLoot","A3XAI_MiscLoot1","A3XAI_MiscLoot2","A3XAI_airReinforcementVehicles","A3XAI_uniformTypes0",
  58.     "A3XAI_uniformTypes1","A3XAI_uniformTypes2","A3XAI_uniformTypes3","A3XAI_launcherTypes",
  59.     "A3XAI_vestTypes0","A3XAI_vestTypes1","A3XAI_vestTypes2","A3XAI_vestTypes3"];
  60. };
  61.  
  62.  
  63. if (A3XAI_generateDynamicUniforms) then {
  64.     _skinlist = [] execVM format ['%1\scripts\A3XAI_buildUniformList.sqf',A3XAI_directory];
  65.     uiSleep 2;
  66. };
  67.  
  68. //Build weapon classname tables
  69. if (A3XAI_generateDynamicWeapons) then {
  70.     _weaponlist = [] execVM format ['%1\scripts\A3XAI_buildWeaponList.sqf',A3XAI_directory];
  71.     uiSleep 2;
  72. };
  73.  
  74. //Build backpack classname tables
  75. if (A3XAI_generateDynamicBackpacks) then {
  76.     _backpacklist = [] execVM format ['%1\scripts\A3XAI_buildBackpackList.sqf',A3XAI_directory];
  77.     uiSleep 2;
  78. };
  79.  
  80. //Build vest classname tables
  81. if (A3XAI_generateDynamicVests) then {
  82.     _vestlist = [] execVM format ['%1\scripts\A3XAI_buildVestList.sqf',A3XAI_directory];
  83.     uiSleep 2;
  84. };
  85.  
  86. //Build headgear classname tables
  87. if (A3XAI_generateDynamicHeadgear) then {
  88.     _headgearlist = [] execVM format ['%1\scripts\A3XAI_buildHeadgearList.sqf',A3XAI_directory];
  89.     uiSleep 2;
  90. };
  91.  
  92. //Build food classname tables (1)
  93. if (A3XAI_generateDynamicFood) then {
  94.     _foodlist = [] execVM format ['%1\scripts\A3XAI_buildFoodList.sqf',A3XAI_directory];
  95.     uiSleep 2;
  96. };
  97.  
  98. //Build generic loot classname tables (1)
  99. if (A3XAI_generateDynamicLoot) then {
  100.     _lootlist = [] execVM format ['%1\scripts\A3XAI_buildLootList.sqf',A3XAI_directory];
  101.     uiSleep 2;
  102. };
  103.  
  104. if (A3XAI_generateDynamicOptics) then {
  105.     _weaponScopes = [] execVM format ['%1\scripts\A3XAI_buildScopeList.sqf',A3XAI_directory];
  106.     uiSleep 2;
  107. };
  108.  
  109. //Check classname tables if enabled
  110. if (A3XAI_verifyClassnames) then {
  111.     _verifyClassnames = [] execVM format ["%1\scripts\verifyClassnames.sqf",A3XAI_directory];
  112.     uiSleep 2;
  113. };
  114.  
  115. if (A3XAI_enableHC && {A3XAI_waitForHC}) then {
  116.     diag_log "[A3XAI] Waiting for headless client to connect. A3XAI post-initialization process paused.";
  117.     waitUntil {uiSleep 5; A3XAI_HCIsConnected};
  118.     diag_log format ["[A3XAI] Headless client connected with owner ID %1. A3XAI post-initialization process continuing.",A3XAI_HCObjectOwnerID];
  119. };
  120.  
  121. A3XAI_classnamesVerified = true;
  122.  
  123. //Build map location list.
  124. _setupLocations = [] execVM format ['%1\scripts\setup_locations.sqf',A3XAI_directory];
  125.  
  126. //Set up auto-generated static spawns
  127. if (A3XAI_enableStaticSpawns) then {
  128.     _staticSpawns = [] execVM format ["%1\scripts\generateStaticSpawns.sqf",A3XAI_directory];
  129. };
  130.  
  131. //Start dynamic spawn manager
  132. if !(A3XAI_maxDynamicSpawns isEqualTo 0) then {
  133.     _dynManagerV2 = [] execVM format ['%1\scripts\dynamicSpawn_manager.sqf',A3XAI_directory];
  134. };
  135.  
  136. //Set up vehicle patrols
  137. if ((A3XAI_maxAirPatrols > 0) or {(A3XAI_maxLandPatrols > 0)}) then {
  138.     _vehicles = [] execVM format ['%1\scripts\setup_veh_patrols.sqf',A3XAI_directory];
  139. };
  140.  
  141. //Load custom definitions file
  142. if (A3XAI_loadCustomFile) then {
  143.     if (isClass (configFile >> "CfgA3XAISettings")) then {
  144.         _customLoader = [] execVM format ["%1\init\A3XAI_custom_loader.sqf",A3XAI_directory]; //0.1.8
  145.     } else {
  146.         diag_log "A3XAI Error: Could not load A3XAI_config.pbo. Unable to load custom definitions.";
  147.     };
  148. };
  149.  
  150. //Load A3XAI server monitor
  151. _serverMonitor = [] execVM format ['%1\scripts\A3XAI_serverMonitor.sqf',A3XAI_directory];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement