Advertisement
Guest User

fixed

a guest
Mar 8th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.64 KB | None | 0 0
  1. /*
  2. COMPOUND mission created by AINC_STALKER with credit to AINC_Trades.
  3. Extended Crate Array and Crate Lists added to difficulty levels.
  4. Allows more customisation of crate contents based on difficulty
  5. SPECIAL 1 and SPECIAL 2 are generally used for high value items.
  6. IE: If this was a building supply mission i would add metal to 1 and concrete to the 2nd.
  7. Easy/mod/difficult/hardcore based on work by [CiC]red_ned http://cic-gaming.co.uk
  8. Overall template based on work by Defent and eraser1
  9. */
  10.  
  11. private ["_num", "_side", "_pos", "_OK", "_difficulty", "_AICount", "_group", "_type", "_launcher", "_staticGuns", "_crate1", "_vehicle", "_pinCode", "_class", "_veh", "_crate_loot_values1", "_missionAIUnits", "_missionObjs", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added", "_cleanup", "_baseObjs", "_crate_weapons", "_crate_weapon_list", "_crate_items", "_crate_item_list", "_crate_backpacks", "_PossibleDifficulty", "_VehicleChance", "_VehicleClass", "_VehicleClasses"];
  12.  
  13. // For logging purposes
  14. _num = DMS_MissionCount;
  15.  
  16. // Set mission side (only "bandit" is supported for now)
  17. _side = "bandit";
  18.  
  19. // This part is unnecessary, but exists just as an example to format the parameters for "DMS_fnc_MissionParams" if you want to explicitly define the calling parameters for DMS_fnc_FindSafePos.
  20. // It also allows anybody to modify the default calling parameters easily.
  21. if ((isNil "_this") || {_this isEqualTo [] || {!(_this isEqualType [])}}) then
  22. {
  23. _this =
  24. [
  25. [10,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],
  26. [
  27. []
  28. ],
  29. _this
  30. ];
  31. };
  32.  
  33. // Check calling parameters for manually defined mission position.
  34. // You can define "_extraParams" to specify the vehicle classname to spawn, either as _vehClass or [_vehClass]
  35. _OK = (_this call DMS_fnc_MissionParams) params
  36. [
  37. ["_pos",[],[[]],[3],[],[],[]],
  38. ["_extraParams",[]]
  39. ];
  40.  
  41. if !(_OK) exitWith
  42. {
  43. diag_log format ["DMS ERROR :: Called MISSION nedresearch_mission.sqf with invalid parameters: %1",_this];
  44. };
  45.  
  46. //create possible difficulty add more of one difficulty to weight it towards that
  47. _PossibleDifficulty = [
  48. "easy",
  49. "easy",
  50. "moderate",
  51. "moderate",
  52. "difficult",
  53. "difficult",
  54. "difficult",
  55. "hardcore",
  56. "hardcore"
  57. ];
  58. //choose difficulty and set value
  59. _difficulty = selectRandom _PossibleDifficulty;
  60.  
  61. switch (_difficulty) do
  62. {
  63. case "easy":
  64. {
  65. _AICount = (20 + (round (random 5)));
  66. _crate_weapons = (10 + (round (random 1)));
  67. _crate_items = (10 + (round (random 1)));
  68. _crate_backpacks = (10 + (round (random 1)));
  69. _VehicleClasses = ["B_G_Offroad_01_armed_F", "B_G_Offroad_01_armed_F"];
  70. _VehicleChance = 25; // as a percentage
  71. };
  72. case "moderate":
  73. {
  74. _AICount = (25 + (round (random 5)));
  75. _crate_weapons = (15 + (round (random 1)));
  76. _crate_items = (15 + (round (random 1)));
  77. _crate_backpacks = (15 + (round (random 1)));
  78. _VehicleClasses = ["B_LSV_01_armed_olive_F", "B_LSV_01_armed_olive_F"];
  79. _VehicleChance = 50; // as a percentage
  80. };
  81. case "difficult":
  82. {
  83. _AICount = (30 + (round (random 5)));
  84. _crate_weapons = (20 + (round (random 1)));
  85. _crate_items = (20 + (round (random 1)));
  86. _crate_backpacks = (20 + (round (random 1)));
  87. _VehicleClasses = ["I_MRAP_03_hmg_F", "I_MRAP_03_hmg_F"];
  88. _VehicleChance = 75; // as a percentage
  89. };
  90. case "hardcore":
  91. {
  92. _AICount = (35 + (round (random 5)));
  93. _crate_weapons = (25 + (round (random 1)));
  94. _crate_items = (25 + (round (random 1)));
  95. _crate_backpacks = (25 + (round (random 1)));
  96. _VehicleClasses = ["B_APC_Tracked_01_CRV_F", "B_APC_Tracked_01_CRV_F"];
  97. _VehicleChance = 100; // as a percentage
  98. };
  99. };
  100.  
  101. //Crate Loot used by all.
  102. _crate_weapons_list = ["arifle_MXC_F","arifle_MX_F","arifle_MX_GL_F","arifle_MXM_F","arifle_MXM_Black_F","arifle_MXC_Black_F","arifle_MX_Black_F","arifle_MX_GL_Black_F","arifle_SPAR_01_blk_F","arifle_SPAR_01_GL_blk_F","arifle_SPAR_02_blk_F","arifle_SPAR_03_blk_F","arifle_MX_SW_Black_F","LMG_Zafir_F","srifle_EBR_F","srifle_DMR_01_F","srifle_DMR_03_woodland_F"];
  103. _crate_items_list = ["Exile_Item_EMRE","Exile_Item_InstantCoffee"];
  104. _crate_backpacks_list = ["B_ViperLightHarness_blk_F","B_Carryall_oucamo","B_AssaultPack_blk"];
  105.  
  106. _group =
  107. [
  108. [[(_pos select 0)+2,(_pos select 1)+4,0],[(_pos select 0)-10,(_pos select 1)+0,0]],
  109. _AICount, // Number of AI
  110. _difficulty, // "random","hardcore","difficult","moderate", or "easy"
  111. "random", // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
  112. _side // "bandit","hero", etc.
  113. ] call DMS_fnc_SpawnAIGroup_MultiPos;
  114.  
  115. // add vehicle patrol
  116. _veh =
  117. [
  118. [
  119. [(_pos select 0)+100,(_pos select 1)+100,0]
  120. ],
  121. _group,
  122. "assault",
  123. _difficulty,
  124. _side
  125. ] call DMS_fnc_SpawnAIVehicle;
  126.  
  127. // add static guns
  128. _staticGuns =
  129. [
  130. [
  131. // make statically positioned relative to centre point, keep static as they are on top of building
  132. [(_pos select 0) -10,(_pos select 1) +10,0],
  133. [(_pos select 0) -10,(_pos select 1) -10,0],
  134. [(_pos select 0) +2,(_pos select 1) +18,+13],
  135. [(_pos select 0) +2,(_pos select 1) -16,+13],
  136. [(_pos select 0) -25,(_pos select 1) +15,+14],
  137. [(_pos select 0) -43,(_pos select 1) +18,+13],
  138. [(_pos select 0) -43,(_pos select 1) -16,+13]
  139. ],
  140. _group,
  141. "assault",
  142. "static",
  143. "bandit"
  144. ] call DMS_fnc_SpawnAIStaticMG;
  145.  
  146. // Create buildings - check OBJECTS sqf matches
  147. _baseObjs =
  148. [
  149. "STALKER_AINC_objects",
  150. _pos
  151. ] call DMS_fnc_ImportFromM3E_3DEN;
  152.  
  153. //choose vehicle from potentials
  154. _VehicleClass = selectRandom _VehicleClasses;
  155.  
  156. if (_VehicleChance >= (random 100)) then
  157. {
  158. _pinCode = (1000 +(round (random 8999)));
  159. _vehicle = [_VehicleClass,[(_pos select 0) +30, (_pos select 1) -0],_pinCode] call DMS_fnc_SpawnPersistentVehicle;
  160. _msgWIN = ['#0080ff',format ["AINC compound secured. %1 secured. Code is %2 ...",_VehicleClass,_pinCode]];
  161. } else
  162. {
  163. _vehicle = [_VehicleClass,[(_pos select 0) +30, (_pos select 1) -0, 0]] call DMS_fnc_SpawnNonPersistentVehicle;
  164. _msgWIN = ['#0080ff',"AINC compound secured."];
  165. };
  166.  
  167. // Create Crate type
  168. _crate1 = ["Box_NATO_Wps_F",_pos] call DMS_fnc_SpawnCrate;
  169.  
  170. // setup crate iteself with items
  171. _crate_loot_values1 =
  172. [
  173. [_crate_weapons,_crate_weapons_list],
  174. [_crate_items,_crate_items_list],
  175. [_crate_backpacks,_crate_backpacks_list]
  176. ];
  177.  
  178. // Define mission-spawned AI Units
  179. _missionAIUnits =
  180. [
  181. _group // We only spawned the single group for this mission
  182. ];
  183.  
  184. // Define mission-spawned objects and loot values
  185. _missionObjs =
  186. [
  187. _staticGuns+_baseObjs+[_veh], // armed AI vehicle, base objects, and static guns
  188. [_vehicle], //this is prize vehicle
  189. [[_crate1,_crate_loot_values1]] //this is prize crate
  190. ];
  191.  
  192. // Define Mission Win message defined in persistent choice
  193. _msgStart = ['#FFFF00',"AINC Security have set up a %1 re-supply compound. Raid them before they complete operations",_difficulty];
  194.  
  195. // Define Mission Lose message
  196. _msgLOSE = ['#FF0000',"EXILE SECURITY HAS DEFENDED THE COMPOUND , PATROLS ARE INCREASING."];
  197.  
  198. // Define mission name (for map marker and logging)
  199. _missionName = "EXILE SECURITY COMPOUND";
  200.  
  201. // Create Markers
  202. _markers =
  203. [
  204. _pos,
  205. _missionName,
  206. _difficulty
  207. ] call DMS_fnc_CreateMarker;
  208.  
  209. // Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
  210. _time = diag_tickTime;
  211.  
  212. // Parse and add mission info to missions monitor
  213. _added =
  214. [
  215. _pos,
  216. [
  217. [
  218. "kill",
  219. _group
  220. ],
  221. [
  222. "playerNear",
  223. [_pos,DMS_playerNearRadius]
  224. ]
  225. ],
  226. [
  227. _time,
  228. (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
  229. ],
  230. _missionAIUnits,
  231. _missionObjs,
  232. [_missionName,_msgWIN,_msgLOSE],
  233. _markers,
  234. _side,
  235. _difficulty,
  236. []
  237. ] call DMS_fnc_AddMissionToMonitor;
  238.  
  239. // Check to see if it was added correctly, otherwise delete the stuff
  240. if !(_added) exitWith
  241. {
  242. diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
  243.  
  244. // Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
  245. _cleanup = [];
  246. {
  247. _cleanup pushBack _x;
  248. } forEach _missionAIUnits;
  249.  
  250. _cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
  251.  
  252. {
  253. _cleanup pushBack (_x select 0);
  254. } foreach (_missionObjs select 2);
  255.  
  256. _cleanup call DMS_fnc_CleanUp;
  257.  
  258. // Delete the markers directly
  259. {deleteMarker _x;} forEach _markers;
  260.  
  261. // Reset the mission count
  262. DMS_MissionCount = DMS_MissionCount - 1;
  263. };
  264.  
  265. // Notify players
  266. [_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus;
  267.  
  268. if (DMS_DEBUG) then
  269. {
  270. (format ["MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time]) call DMS_fnc_DebugLog;
  271. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement