Advertisement
Guest User

comms base alpha

a guest
Oct 9th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.35 KB | None | 0 0
  1. /*
  2. "Comms Alpha" v2.1c static mission for Tanoa.
  3. Created by [CiC]red_ned using templates by eraser1
  4. Exile_Car_BTR40_Camo increases persistent chance with difficulty
  5. 17 years of CiC
  6. easy/mod/difficult/hardcore - reworked by [CiC]red_ned http://cic-gaming.co.uk
  7. */
  8.  
  9. private ["_AICount", "_AIMaxReinforcements", "_AItrigger", "_AIwave", "_AIdelay", "_staticguns", "_missionObjs", "_crate0", "_crate1", "_crate_loot_values0", "_crate_loot_values1", "_crate_weapons0", "_crate_weapons1", "_crate_items0", "_crate_items1", "_crate_backpacks0", "_crate_backpacks1", "_difficultyM", "_difficulty", "_PossibleDifficulty", "_msgWIN", "_vehicle", "_pinCode", "_VehicleChance", "_cash"];
  10.  
  11. // For logging purposes
  12. _num = DMS_MissionCount;
  13.  
  14. // Set mission side (only "bandit" is supported for now)
  15. _side = "bandit";
  16.  
  17. _pos = [10033.3,11792.4,0]; //insert the centre here
  18.  
  19. if ([_pos,DMS_StaticMinPlayerDistance] call DMS_fnc_IsPlayerNearby) exitWith {"delay"};
  20.  
  21. //create possible difficulty add more of one difficulty to weight it towards that
  22. _PossibleDifficulty = [
  23. "easy",
  24. "moderate",
  25. "moderate",
  26. "difficult",
  27. "difficult",
  28. "difficult",
  29. "hardcore",
  30. "hardcore",
  31. "hardcore",
  32. "hardcore"
  33. ];
  34. //choose mission difficulty and set value and is also marker colour
  35. _difficultyM = selectRandom _PossibleDifficulty;
  36.  
  37. switch (_difficultyM) do
  38. {
  39. case "easy":
  40. {
  41. _difficulty = "easy"; //AI difficulty
  42. _AICount = (15 + (round (random 5))); //AI starting numbers
  43. _AIMaxReinforcements = (10 + (round (random 30))); //AI reinforcement cap
  44. _AItrigger = (10 + (round (random 5))); //If AI numbers fall below this number then reinforce if any left from AIMax
  45. _AIwave = (4 + (round (random 4))); //Max amount of AI in reinforcement wave
  46. _AIdelay = (55 + (round (random 120))); //The delay between reinforcements
  47. _VehicleChance = 10; //10% SpawnPersistentVehicle chance
  48. _crate_weapons0 = (5 + (round (random 20))); //Crate 0 weapons number
  49. _crate_items0 = (5 + (round (random 20))); //Crate 0 items number
  50. _crate_backpacks0 = (3 + (round (random 1))); //Crate 0 back packs number
  51. _crate_weapons1 = (4 + (round (random 2))); //Crate 1 weapons number
  52. _crate_items1 = (10 + (round (random 40))); //Crate 1 items number
  53. _crate_backpacks1 = (1 + (round (random 8))); //Crate 1 back packs number
  54. _cash = (250 + round (random (500))); // cash in crate
  55. };
  56. case "moderate":
  57. {
  58. _difficulty = "moderate";
  59. _AICount = (20 + (round (random 5)));
  60. _AIMaxReinforcements = (20 + (round (random 20)));
  61. _AItrigger = (10 + (round (random 10)));
  62. _AIwave = (5 + (round (random 3)));
  63. _AIdelay = (55 + (round (random 120)));
  64. _VehicleChance = 20; //20% SpawnPersistentVehicle chance
  65. _crate_weapons0 = (10 + (round (random 15)));
  66. _crate_items0 = (10 + (round (random 15)));
  67. _crate_backpacks0 = (3 + (round (random 1)));
  68. _crate_weapons1 = (6 + (round (random 3)));
  69. _crate_items1 = (20 + (round (random 30)));
  70. _crate_backpacks1 = (5 + (round (random 4)));
  71. _cash = (250 + round (random (500))); // cash in crate
  72. };
  73. case "difficult":
  74. {
  75. _difficulty = "difficult";
  76. _AICount = (20 + (round (random 7)));
  77. _AIMaxReinforcements = (30 + (round (random 20)));
  78. _AItrigger = (10 + (round (random 10)));
  79. _AIwave = (6 + (round (random 2)));
  80. _AIdelay = (55 + (round (random 120)));
  81. _VehicleChance = 75; //75% SpawnPersistentVehicle chance
  82. _crate_weapons0 = (30 + (round (random 20)));
  83. _crate_items0 = (15 + (round (random 10)));
  84. _crate_backpacks0 = (3 + (round (random 1)));
  85. _crate_weapons1 = (8 + (round (random 3)));
  86. _crate_items1 = (30 + (round (random 20)));
  87. _crate_backpacks1 = (6 + (round (random 4)));
  88. _cash = (250 + round (random (500))); // cash in crate
  89. };
  90. //case "hardcore":
  91. default
  92. {
  93. _difficulty = "hardcore";
  94. _AICount = (20 + (round (random 10)));
  95. _AIMaxReinforcements = (40 + (round (random 10)));
  96. _AItrigger = (15 + (round (random 5)));
  97. _AIwave = (6 + (round (random 2)));
  98. _AIdelay = (55 + (round (random 120)));
  99. _VehicleChance = 90; //90% SpawnPersistentVehicle chance
  100. _crate_weapons0 = (20 + (round (random 5)));
  101. _crate_items0 = (20 + (round (random 5)));
  102. _crate_backpacks0 = (2 + (round (random 1)));
  103. _crate_weapons1 = (10 + (round (random 2)));
  104. _crate_items1 = (40 + (round (random 10)));
  105. _crate_backpacks1 = (10 + (round (random 2)));
  106. _cash = (250 + round (random (500))); // cash in crate
  107. };
  108. };
  109.  
  110. // Define spawn locations for AI Soldiers. These will be used for the initial spawning of AI as well as reinforcements.
  111. // The center spawn location is added 3 times so at least 3 AI will spawn initially at the center location, and so that future reinforcements are more likely to spawn at the center.
  112. _AISoldierSpawnLocations =
  113. [
  114. [10023.8,11830.5,0],
  115. [10022.5,11806.9,0],
  116. [10043.2,11809.6,0],
  117. [9947.78,11805.3,0],
  118. [9949.77,11790.5,0.0664],
  119. [9943.55,11776.7,0],
  120. [9976.6,11779.4,0],
  121. [9993.78,11779.1,0],
  122. [10009.2,11781.3,0],
  123. [10057.1,11759.3,0.0236],
  124. [10062.2,11767.4,0],
  125. [10064.7,11796.8,0],
  126. [10063.5,11784,0],
  127. [10070.1,11756.7,0],
  128. [10064.9,11756,0],
  129. [10070.8,11768.8,0],
  130. [10094.3,11744.7,0],
  131. [10083.8,11749.5,0],
  132. [10098.8,11755.1,0],
  133. [10101.7,11787.7,0],
  134. [10096.2,11795.7,0.1512],
  135. [10035.4,11760.8,0],
  136. [10018.3,11759.8,0],
  137. [10024.2,11783.8,0],
  138. [10040.8,11791.7,0],
  139. [9978.8,11817,0],
  140. [10013.9,11827.5,0],
  141. [10053.3,11828.3,0],
  142. [10075,11809.2,0],
  143. [10104.3,11745.3,0],
  144. [10000.7,11802.7,0],
  145. [10044.1,11795.7,0.5526],
  146. [10017.9,11802.8,0.6483]
  147. ];
  148.  
  149. _group =
  150. [
  151. _AISoldierSpawnLocations+[_pos,_pos,_pos], // Pass the regular spawn locations as well as the center pos 3x
  152. _AICount, // Set in difficulty select
  153. _difficulty, // Set in difficulty select
  154. "random",
  155. _side
  156. ] call DMS_fnc_SpawnAIGroup_MultiPos;
  157.  
  158. //Reduce Static guns if mission is easy
  159. if (_difficultyM isEqualTo "easy") then {
  160. _staticGuns =
  161. [
  162. [
  163. [10101.7,11736.9,0],
  164. [10119.5,11744.2,0],
  165. [10083.8,11745,0],
  166. [10072.2,11749.3,0],
  167. [10041.5,11781.4,0],
  168. [10009.8,11811.1,0],
  169. [9972.2,11806,0],
  170. [9970.87,11781,0],
  171. [9941.86,11782.5,0],
  172. [10062.5,11824.7,0],
  173. [10075.7,11772.3,0],
  174. [10064,11791.8,0],
  175. [10064.3,11801.7,0]
  176. ],
  177. _group,
  178. "assault",
  179. _difficulty,
  180. "bandit",
  181. "random"
  182. ] call DMS_fnc_SpawnAIStaticMG;
  183. } else
  184. {
  185. _staticGuns =
  186. [
  187. [
  188. _pos vectorAdd [-5,0,0], // 5 meters West of center pos
  189. _pos vectorAdd [0,-5,0], // 5 meters South of center pos
  190. [10045.3,11760.9,0],
  191. [10101.7,11736.9,0],
  192. [10119.5,11744.2,0],
  193. [10083.8,11745,0],
  194. [10072.2,11749.3,0],
  195. [10041.5,11781.4,0],
  196. [10009.8,11811.1,0],
  197. [9972.2,11806,0],
  198. [9970.87,11781,0],
  199. [9941.86,11782.5,0],
  200. [10062.5,11824.7,0],
  201. [10075.7,11772.3,0],
  202. [10064,11791.8,0],
  203. [10064.3,11801.7,0]
  204. ],
  205. _group,
  206. "assault",
  207. _difficulty,
  208. "bandit",
  209. "random"
  210. ] call DMS_fnc_SpawnAIStaticMG;
  211. };
  212.  
  213. // Define the classnames and locations where the crates can spawn (at least 2, since we're spawning 2 crates)
  214. _crateClasses_and_Positions =
  215. [
  216. [[9947.22,11791,0.0769348],"I_CargoNet_01_ammo_F"],
  217. [[10056,11761.6,0],"I_CargoNet_01_ammo_F"],
  218. [[10088.9,11747,0.119232],"I_CargoNet_01_ammo_F"],
  219. [[10067.4,11760,0.085144],"I_CargoNet_01_ammo_F"],
  220. [[9998.37,11783.5,0],"I_CargoNet_01_ammo_F"]
  221. ];
  222.  
  223. {
  224. deleteVehicle (nearestObject _x); // Make sure to remove any previous crates.
  225. } forEach _crateClasses_and_Positions;
  226.  
  227. // Shuffle the list
  228. _crateClasses_and_Positions = _crateClasses_and_Positions call ExileClient_util_array_shuffle;
  229.  
  230. // Create Crates
  231. _crate0 = [_crateClasses_and_Positions select 0 select 1, _crateClasses_and_Positions select 0 select 0] call DMS_fnc_SpawnCrate;
  232. _crate1 = [_crateClasses_and_Positions select 1 select 1, _crateClasses_and_Positions select 1 select 0] call DMS_fnc_SpawnCrate;
  233.  
  234. // load tabs in
  235. _crate0 setVariable ["ExileMoney", _cash,true];
  236. //_crate1 setVariable ["ExileMoney", _cash,true];
  237. // Enable smoke on the crates due to size of area
  238. {
  239. _x setVariable ["DMS_AllowSmoke", true];
  240. } forEach [_crate0,_crate1];
  241.  
  242. // Define mission-spawned AI Units
  243. _missionAIUnits =
  244. [
  245. _group // We only spawned the single group for this mission
  246. ];
  247.  
  248. // Define the group reinforcements
  249. _groupReinforcementsInfo =
  250. [
  251. [
  252. _group, // pass the group
  253. [
  254. [
  255. 0, // Let's limit number of units instead...
  256. 0
  257. ],
  258. [
  259. _AIMaxReinforcements, // Maximum units that can be given as reinforcements (defined in difficulty selection).
  260. 0
  261. ]
  262. ],
  263. [
  264. _AIdelay, // The delay between reinforcements. >> you can change this in difficulty settings
  265. diag_tickTime
  266. ],
  267. _AISoldierSpawnLocations,
  268. "random",
  269. _difficulty,
  270. _side,
  271. "reinforce",
  272. [
  273. _AItrigger, // Set in difficulty select - Reinforcements will only trigger if there's fewer than X members left
  274. _AIwave // X reinforcement units per wave. >> you can change this in mission difficulty section
  275. ]
  276. ]
  277. ];
  278.  
  279. // setup crates with items from choices
  280. _crate_loot_values0 =
  281. [
  282. _crate_weapons0, // Set in difficulty select - Weapons
  283. _crate_items0, // Set in difficulty select - Items
  284. _crate_backpacks0 // Set in difficulty select - Backpacks
  285. ];
  286. _crate_loot_values1 =
  287. [
  288. _crate_weapons1, // Set in difficulty select - Weapons
  289. _crate_items1, // Set in difficulty select - Items
  290. _crate_backpacks1 // Set in difficulty select - Backpacks
  291. ];
  292.  
  293. // is %chance greater than random number
  294. if (_VehicleChance >= (random 100)) then {
  295. _pinCode = (1000 +(round (random 8999)));
  296. _vehicle = ["Exile_Car_BTR40_Camo",[9947,11799.4,0],_pinCode] call DMS_fnc_SpawnPersistentVehicle;
  297. _msgWIN = ['#0080ff',format ["Convicts have successfully cleared Comms Alpha Station and stolen all the crates, BTR40 entry code is %1...",_pinCode]];
  298. } else
  299. {
  300. _vehicle = ["Exile_Car_BTR40_Camo",[9947,11799.4,0]] call DMS_fnc_SpawnNonPersistentVehicle;
  301. _msgWIN = ['#0080ff',"Convicts have successfully cleared Comms Alpha Station and stolen all the crates"];
  302. };
  303.  
  304. // Define mission-spawned objects and loot values with vehicle
  305. _missionObjs =
  306. [
  307. _staticGuns, // static gun(s). Note, we don't add the base itself because it already spawns on server start.
  308. [_vehicle], // vehicle prize
  309. [[_crate0,_crate_loot_values0],[_crate1,_crate_loot_values1]]
  310. ];
  311.  
  312. // Define Mission Start message
  313. _msgStart = ['#FFFF00',format["Comms Alpha Station is being invaded by %1 terrorists",_difficultyM]];
  314.  
  315. // Define Mission Win message defined in vehicle choice
  316.  
  317. // Define Mission Lose message
  318. _msgLOSE = ['#FF0000',"Invaders have stripped Comms Alpha Station of loot and left."];
  319.  
  320. // Define mission name (for map marker and logging)
  321. _missionName = "Comms Alpha Invasion";
  322.  
  323. // Create Markers
  324. _markers =
  325. [
  326. _pos,
  327. _missionName,
  328. _difficultyM
  329. ] call DMS_fnc_CreateMarker;
  330.  
  331. _circle = _markers select 1;
  332. _circle setMarkerDir 0;
  333. _circle setMarkerSize [150,150];
  334.  
  335. _time = diag_tickTime;
  336.  
  337. // Parse and add mission info to missions monitor
  338. _added =
  339. [
  340. _pos,
  341. [
  342. [
  343. "kill",
  344. _group
  345. ],
  346. [
  347. "playerNear",
  348. [_pos,100]
  349. ]
  350. ],
  351. _groupReinforcementsInfo,
  352. [
  353. _time,
  354. DMS_StaticMissionTimeOut call DMS_fnc_SelectRandomVal
  355. ],
  356. _missionAIUnits,
  357. _missionObjs,
  358. [_missionName,_msgWIN,_msgLOSE],
  359. _markers,
  360. _side,
  361. _difficultyM,
  362. [[],[]]
  363. ] call DMS_fnc_AddMissionToMonitor_Static;
  364.  
  365. // Check to see if it was added correctly, otherwise delete the stuff
  366. if !(_added) exitWith
  367. {
  368. diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_fnc_AddMissionToMonitor_Static! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
  369.  
  370. _cleanup = [];
  371. {
  372. _cleanup pushBack _x;
  373. } forEach _missionAIUnits;
  374.  
  375. _cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
  376.  
  377. {
  378. _cleanup pushBack (_x select 0);
  379. } foreach (_missionObjs select 2);
  380.  
  381. _cleanup call DMS_fnc_CleanUp;
  382.  
  383. // Delete the markers directly
  384. {deleteMarker _x;} forEach _markers;
  385.  
  386. // Reset the mission count
  387. DMS_MissionCount = DMS_MissionCount - 1;
  388. };
  389.  
  390. // Notify players
  391. [_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus;
  392.  
  393. if (DMS_DEBUG) then
  394. {
  395. (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;
  396. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement