Advertisement
Palland

A3XAI - Add vehicle loot

Mar 31st, 2019
1,872
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.17 KB | None | 0 0
  1. // This is meant for Kuplion´s A3XAI Version = "0.2.1"
  2.  
  3. // Open a3xai.pbo and find loadSettings.sqf located in a3xai\init
  4.  
  5. // Search for miscLootCount and insert this code underneath :
  6.  
  7.  
  8. ["weaponLootVehicleCount",6],
  9. ["ammoLootPerWeapon",3],
  10. ["foodLootVehicleCount",6],
  11. ["miscLootVehicleCount",6],
  12. ["medicalLootVehicleCount",3],
  13. ["medicalLoot",["Exile_Item_InstaDoc","Exile_Item_Bandage","Exile_Item_Vishpirin"]],
  14.  
  15. // as shown below.
  16.  
  17. ["foodLootCount",2],
  18. ["miscLootCount",2],
  19. ["weaponLootVehicleCount",6],
  20. ["ammoLootPerWeapon",3],
  21. ["foodLootVehicleCount",6],
  22. ["miscLootVehicleCount",6],
  23. ["medicalLootVehicleCount",3],
  24. ["medicalLoot",["Exile_Item_InstaDoc","Exile_Item_Bandage","Exile_Item_Vishpirin"]],
  25. ["firstAidKitChance",0.25],
  26. ["lootPullChance0",0.20,true],
  27. ["lootPullChance1",0.40,true],
  28. ["lootPullChance2",0.60,true],
  29.  
  30.  
  31. // Open A3XAI_functions.sqf
  32.  
  33. // Search for A3XAI_fixStuckGroup and insert this code underneath:
  34.  
  35. A3XAI_generateVehicleLoot = compileFinal preprocessFileLineNumbers format ["%1\compile\A3XAI_utilities\A3XAI_generateVehicleLoot.sqf",A3XAI_directory];
  36.  
  37. // as shown below.
  38.  
  39. A3XAI_fixStuckGroup = compileFinal preprocessFileLineNumbers format ["%1\compile\A3XAI_utilities\A3XAI_fixStuckGroup.sqf",A3XAI_directory];
  40. A3XAI_generateVehicleLoot = compileFinal preprocessFileLineNumbers format ["%1\compile\A3XAI_utilities\A3XAI_generateVehicleLoot.sqf",A3XAI_directory];
  41. A3XAI_getNoAggroStatus = compileFinal preprocessFileLineNumbers format ["%1\compile\A3XAI_utilities\A3XAI_getNoAggroStatus.sqf",A3XAI_directory];
  42.  
  43. // Go to a3xai\scripts and open verifyClassnames.sqf
  44.  
  45. // Search for A3XAI_sniperList isEqualTo and overwrite existing code underneath with this code :
  46.  
  47. if (A3XAI_foodLoot isEqualTo []) then {A3XAI_foodLootCount = 0; A3XAI_foodLootVehicleCount = 0;};
  48. if (A3XAI_miscLoot isEqualTo []) then {A3XAI_miscLootCount = 0; A3XAI_miscLootVehicleCount = 0;};
  49. if (A3XAI_medicalLoot isEqualTo []) then {A3XAI_medicalLootCount = 0; A3XAI_medicalLootVehicleCount = 0;};
  50. if (A3XAI_airReinforcementVehicles isEqualTo []) then {A3XAI_maxAirReinforcements = 0; A3XAI_airReinforcementSpawnChance1 = 0; A3XAI_airReinforcementSpawnChance2 = 0; A3XAI_airReinforcementSpawnChance3 = 0;};
  51.  
  52. diag_log format ["[A3XAI] Verified %1 unique classnames in %2 seconds.",(count _verified),(diag_tickTime - _startTime)];
  53.  
  54.  
  55. // Create a new file and name it A3XAI_generateVehicleLoot.sqf
  56.  
  57. // Insert code below and save it.
  58. ******************Code starts below***************************************
  59.  
  60. #include "\A3XAI\globaldefines.hpp"
  61.  
  62. private ["_vehicle", "_unitLevel", "_weapon", "_magazine", "_lootItem"];
  63.  
  64. _vehicle = _this;
  65.  
  66. if (isNull _vehicle) exitWith {};
  67.  
  68. _unitLevel = A3XAI_unitLevels call A3XAI_selectRandom;
  69.  
  70. for "_i" from 1 to A3XAI_weaponLootVehicleCount do {
  71. _weapon = _unitLevel call A3XAI_getWeapon;
  72. _magazine = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select 0;
  73. _vehicle addWeaponCargoGlobal [_weapon,1];
  74. _vehicle addMagazineCargoGlobal [_magazine,A3XAI_ammoLootPerWeapon];
  75. };
  76.  
  77. for "_i" from 1 to A3XAI_foodLootVehicleCount do {
  78. _lootItem = (A3XAI_foodLoot call A3XAI_selectRandom);
  79. _vehicle addItemCargoGlobal [_lootItem,1];
  80. };
  81.  
  82. for "_i" from 1 to A3XAI_miscLootVehicleCount do {
  83. _lootItem = (A3XAI_miscLoot call A3XAI_selectRandom);
  84. _vehicle addItemCargoGlobal [_lootItem,1];
  85. };
  86.  
  87. for "_i" from 1 to A3XAI_medicalLootVehicleCount do {
  88. _lootItem = (A3XAI_medicalLoot call A3XAI_selectRandom);
  89. _vehicle addItemCargoGlobal [_lootItem,1];
  90. };
  91.  
  92. if (A3XAI_debugLevel > 1) then {
  93. diag_log format ["A3XAI Debug: Generated loot for AI %1 at %2 with unitLevel %3.",(typeOf _vehicle),(getPosATL _vehicle),_unitLevel];
  94. };
  95.  
  96. true
  97.  
  98. *************************** CODE ENDS ABOVE *******************************************
  99.  
  100. // Copy A3XAI_generateVehicleLoot.sqf to a3xai\compile\A3XAI_utilities.
  101.  
  102.  
  103. // open A3XAI_releaseVehicleAllow.sqf in a3xai\compile\A3XAI_utilities.
  104.  
  105. // Search for if (isDedicated) and insert this code underneath: _object call A3XAI_generateVehicleLoot;
  106.  
  107. // as shown below:
  108.  
  109. if (isDedicated) then {
  110. _object call A3XAI_generateVehicleLoot;
  111. _object addEventHandler ["GetIn",{
  112. if (isPlayer (_this select 2)) then {
  113. (_this select 0) call A3XAI_releaseVehicleNow;
  114.  
  115.  
  116.  
  117.  
  118.  
  119. // save and repack pbo.
  120.  
  121.  
  122. // Open config in A3XAI_config.pbo
  123.  
  124. // Search for miscLootCount and insert this code underneath:
  125.  
  126.  
  127.  
  128. /* AI loot quantity settings (Vehicle)
  129.  
  130. Note: A3XAI_vehiclesAllowedForPlayers = 1; must be set in order to enable the settings in this section
  131. --------------------------------------------------------------------------------------------------------------------*/
  132.  
  133. //Maximum number of weapons from pistolList, rifleList, machinegunList, sniperList found in vehicles recovered by players. (Default: 5)
  134. weaponLootVehicleCount = 5;
  135.  
  136. //Maximum number of magazines to generate for each weapon loot added to vehicle inventory (Default: 3)
  137. ammoLootPerWeapon = 3;
  138.  
  139. //Maximum number of food loot items from foodLoot found in vehicles recovered by players. (Default: 10)
  140. foodLootVehicleCount = 2;
  141.  
  142. //Maximum number of items to select from miscLoot found in vehicles recovered by players. (Default: 10)
  143. miscLootVehicleCount = 10;
  144.  
  145. //Maximum number of items to select from medicalLoot found in vehicles recovered by players. (Default: 5)
  146. medicalLootVehicleCount = 3;
  147.  
  148. /* AI loot probability settings. AI loot is pre-generated into a pool for each unit and randomly pulled to units as time passes.
  149. --------------------------------------------------------------------------------------------------------------------*/
  150.  
  151. //add to config below miscLoot[] array
  152.  
  153. //AI Medical item types.
  154. // Note: medicalLoot will not be read if generateMedicalFood is enabled.
  155. //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  156. medicalLoot[] = {"Exile_Item_InstaDoc","Exile_Item_Bandage","Exile_Item_Vishpirin"};
  157.  
  158.  
  159. // save and repack pbo.
  160.  
  161. // If using a HC copy a3xai.pbo to HC folder and overwrite existing pbo.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement