Advertisement
skotracker

paraDrop

Apr 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 13.11 KB | None | 0 0
  1. /*
  2.     File: randomDrop.sqf
  3.     Author: =CF=Dragunov, adapted from original spawnboxes from NedFox [TZW] and paraDrop from KK
  4.     Description: Custom paraDrops, randomly dropped, with adjustable intervals.
  5. */
  6.  
  7. if (!isServer) exitWith {};
  8.  
  9. uiSleep 1800;
  10.  
  11. _world = (toLower worldName);
  12. _middle = worldSize/2;
  13. _spawnCenter    = [_middle,_middle,0];
  14. _max        = _middle - 100;
  15.  
  16. switch (toLower worldName) do
  17. {
  18.     case "altis":
  19.     {
  20.         _spawnCenter = [15234.2,14987.8,0];
  21.         _max = 15000;
  22.     };
  23.     case "chernarus":
  24.     {
  25.         _spawnCenter = [7652.9634, 7870.8076,0];
  26.         _max = 7500;
  27.     };
  28.     case "taviana":
  29.     {
  30.         _spawnCenter = [12800, 12800,0];
  31.         _max = 12800;
  32.     };
  33. };
  34. diag_log format['[paraDrop] worldname: %1 Centre: %2 radius: %3',_world,_spawnCenter,_max];
  35.  
  36. _min                = 0; // minimum distance from the center position (Number) in meters
  37. _mindist            = 5; // minimum distance from the nearest object (Number) in meters, ie. spawn at least this distance away from anything within x meters..
  38. _water              = 0; // water mode (Number) 0: cannot be in water , 1: can either be in water or not , 2: must be in water
  39. _shoremode          = 0; // 0: does not have to be at a shore , 1: must be at a shore
  40. _marker             = true; // Draw a yellow circle in which the crate will be spawned randomly
  41. _markersize         = 100; // Radius of the marker in meters
  42.  
  43. private['_position'];
  44.  
  45. diag_log format['[paraDrop] Starting @ %1',time];
  46.  
  47. ////////////////////////////////////////////////////////////////////////////////////////////////////
  48. //Drop 1 is a Kuma
  49. ////////////////////////////////////////////////////////////////////////////////////////////////////
  50.  
  51.     _validspot  = false;
  52.     while{!_validspot} do
  53.     {
  54.         sleep 1;
  55.         _position = [_spawnCenter,_min,_max,_mindist,_water,2000,_shoremode] call BIS_fnc_findSafePos;
  56.         _validspot  = true;
  57.  
  58.  
  59.         //Check if near another drop
  60.         // Get nearest I_MBT_03_cannon_F
  61.         _nearOtherCrate = (nearestObjects [_position,["rhssaf_army_pts"],750]) select 0;
  62.         if (!isNil "_nearOtherCrate") then
  63.         {
  64.             _nearestCrate = _position distance _nearOtherCrate;
  65.             if (_nearestCrate < 750) then
  66.             {
  67.                 _validspot = false;
  68.             };
  69.         };
  70.  
  71.         //Check if near player base
  72.         // Get nearest Exile_Construction_Flag_Static
  73.         _nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],750]) select 0;
  74.         if (!isNil "_nearBase") then
  75.         {
  76.             _nearestBase = _position distance _nearBase;
  77.             if (_nearestBase < 750) then
  78.             {
  79.                 _validspot = false;
  80.             };
  81.         };
  82.  
  83.     };
  84.  
  85.     if (_marker) then
  86.     {
  87.         _event_marker11 = createMarker [ format ["loot_marker_%1", 11], _position];
  88.         _event_marker11 setMarkerColor "ColorBlue";
  89.         _event_marker11 setMarkerAlpha 0.85;
  90.         _event_marker11 setMarkerText "Drop1";
  91.         _event_marker11 setMarkerType "loc_Tree";
  92.         _event_marker11 setMarkerBrush "Vertical";
  93.         _event_marker11 setMarkerSize [(2), (2)];
  94.     };
  95.  
  96.     diag_log format['paraDrop %1 : Location %2',11,_position];
  97.  
  98.     diag_log text format ["[paraDrop]: Creating drop zone %1",_position];
  99.  
  100. //Call function
  101. //_spawnPosition = [_position select 0, _position select 1, 300];
  102. _tank = "rhssaf_army_pts" createVehicle [0,0,0];
  103. _tank setDir random 360;
  104. _tank setPos [_position select 0, _position select 1, 300];
  105. _tank call KK_fnc_paraDrop;
  106.  
  107.     diag_log format['[paraDrop] Dropped tank 1: ',_Position];
  108.  
  109.     clearMagazineCargoGlobal _tank;
  110.     clearWeaponCargoGlobal _tank;
  111.     clearItemCargoGlobal _tank;
  112.     _tank setVariable ["permaLoot",true]; //stay until reset
  113.     _tank allowDamage false; // Prevent boxes to explode when spawning
  114.  
  115.     _tank addItemCargoGlobal ["Exile_Item_DuctTape", 2 + (random 2)];
  116.     _tank addItemCargoGlobal ["Exile_Item_JunkMetal",  (random 8)];
  117.     _tank addItemCargoGlobal ["Exile_Item_MetalPole",  (random 7)];
  118.     _tank addMagazineCargoGlobal ["ClaymoreDirectionalMine_Remote_Mag", (random 2)];
  119.     _tank addItemCargoGlobal ["Exile_Item_WoodFloorKit", 2 + (random 10)];
  120.     _tank addItemCargoGlobal ["Exile_Item_WoodPlank", 2 + (random 10)];
  121.     _tank addItemCargoGlobal ["Exile_Item_WoodWallKit",  (random 7)];
  122.     _tank addItemCargoGlobal ["Exile_Item_InstaDoc", 1 + (random 2)];
  123.     _tank addItemCargoGlobal ["Exile_Item_FortificationUpgrade",  (random 4)];
  124.     _tank addItemCargoGlobal ["Exile_Item_BBQSandwich_Cooked", 1 + (random 4)];
  125.     _tank addItemCargoGlobal ["Exile_Item_Energydrink", 1 + (random 3)];
  126.     _tank addWeaponCargoGlobal ["srifle_LRR_camo_F",  (random 1)];
  127.     _tank addWeaponCargoGlobal ["rhs_weap_M107", (random 1)];
  128.     _tank addWeaponCargoGlobal ["arifle_SDAR_F", 1 + (random 1)];
  129.     _tank addMagazineCargoGlobal ["20Rnd_556x45_UW_mag",3 + (random 5)];
  130.     _tank addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", (random 1)];
  131.     _tank addItemCargoGlobal ["Exile_Item_Bandage", 1 + (random 5)];
  132.     _tank addMagazineCargoGlobal ["150Rnd_93x64_Mag", (random 2)];
  133.     _tank addMagazineCargoGlobal ["130Rnd_338_Mag", (random 2)];
  134.     _tank setVariable ["ExileMoney",10001,true]; // rod
  135.  
  136. playsound "Drop";
  137. Hint "Intel: Air Support has paradropped a Tank";
  138. uiSleep 30;
  139. Hint "";
  140.  
  141. ////////////////////////////////////////////////////////////////////////////////////////////////////
  142. //Drop 2 is a rhsgref_un_m1117
  143. ////////////////////////////////////////////////////////////////////////////////////////////////////
  144.  
  145. uiSleep 2800;
  146.  
  147.     _validspot  = false;
  148.     while{!_validspot} do
  149.     {
  150.         sleep 1;
  151.         _position = [_spawnCenter,_min,_max,_mindist,_water,2000,_shoremode] call BIS_fnc_findSafePos;
  152.         _validspot  = true;
  153.  
  154.  
  155.         //Check if near another drop
  156.         // Get nearest rhsgref_un_m1117
  157.         _nearOtherCrate = (nearestObjects [_position,["rhsgref_un_m1117"],750]) select 0;
  158.         if (!isNil "_nearOtherCrate") then
  159.         {
  160.             _nearestCrate = _position distance _nearOtherCrate;
  161.             if (_nearestCrate < 750) then
  162.             {
  163.                 _validspot = false;
  164.             };
  165.         };
  166.  
  167.         //Check if near player base
  168.         // Get nearest Exile_Construction_Flag_Static
  169.         _nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],750]) select 0;
  170.         if (!isNil "_nearBase") then
  171.         {
  172.             _nearestBase = _position distance _nearBase;
  173.             if (_nearestBase < 750) then
  174.             {
  175.                 _validspot = false;
  176.             };
  177.         };
  178.  
  179.     };
  180.  
  181.     if (_marker) then
  182.     {
  183.         _event_marker12 = createMarker [ format ["loot_marker_%1", 12], _position];
  184.         _event_marker12 setMarkerColor "ColorBlue";
  185.         _event_marker12 setMarkerAlpha 0.85;
  186.         _event_marker12 setMarkerText "Drop2";
  187.         _event_marker12 setMarkerType "loc_Tree";
  188.         _event_marker12 setMarkerBrush "Vertical";
  189.         _event_marker12 setMarkerSize [(2), (2)];
  190.     };
  191.  
  192.     diag_log format['paraDrop %1 : Location %2',12,_position];
  193.  
  194.     diag_log text format ["[paraDrop]: Creating drop zone %1",_position];
  195.  
  196. //Call function
  197. //_spawnPosition = [_position select 0, _position select 1, 300];
  198. _tank = "rhsgref_un_m1117" createVehicle [0,0,0];
  199. _tank setDir random 360;
  200. _tank setPos [_position select 0, _position select 1, 300];
  201. _tank call KK_fnc_paraDrop;
  202.  
  203.     diag_log format['[paraDrop] Dropped tank 2: ',_Position];
  204.  
  205.     clearMagazineCargoGlobal _tank;
  206.     clearWeaponCargoGlobal _tank;
  207.     clearItemCargoGlobal _tank;
  208.     _tank setVariable ["permaLoot",true]; //stay until reset
  209.     _tank allowDamage false; // Prevent boxes to explode when spawning
  210.  
  211.     _tank addItemCargoGlobal ["Exile_Item_DuctTape", 2 + (random 2)];
  212.     _tank addItemCargoGlobal ["Exile_Item_JunkMetal",  (random 8)];
  213.     _tank addItemCargoGlobal ["Exile_Item_MetalPole",  (random 7)];
  214.     _tank addMagazineCargoGlobal ["ClaymoreDirectionalMine_Remote_Mag", (random 2)];
  215.     _tank addItemCargoGlobal ["Exile_Item_WoodFloorKit", 2 + (random 10)];
  216.     _tank addItemCargoGlobal ["Exile_Item_WoodPlank", 2 + (random 10)];
  217.     _tank addItemCargoGlobal ["Exile_Item_WoodWallKit",  (random 7)];
  218.     _tank addItemCargoGlobal ["Exile_Item_InstaDoc", 1 + (random 2)];
  219.     _tank addItemCargoGlobal ["Exile_Item_FortificationUpgrade",  (random 4)];
  220.     _tank addItemCargoGlobal ["Exile_Item_BBQSandwich_Cooked", 1 + (random 4)];
  221.     _tank addItemCargoGlobal ["Exile_Item_Energydrink", 1 + (random 3)];
  222.     _tank addWeaponCargoGlobal ["srifle_LRR_camo_F",  (random 1)];
  223.     _tank addWeaponCargoGlobal ["rhs_weap_M107", (random 1)];
  224.     _tank addWeaponCargoGlobal ["arifle_SDAR_F", 1 + (random 1)];
  225.     _tank addMagazineCargoGlobal ["20Rnd_556x45_UW_mag",3 + (random 5)];
  226.     _tank addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", (random 1)];
  227.     _tank addItemCargoGlobal ["Exile_Item_Bandage", 1 + (random 5)];
  228.     _tank addMagazineCargoGlobal ["150Rnd_93x64_Mag", (random 2)];
  229.     _tank addMagazineCargoGlobal ["130Rnd_338_Mag", (random 2)];
  230.     _tank setVariable ["ExileMoney",10002,true]; // rod
  231.  
  232. playsound "drop";
  233. Hint "Intel: Air Support has paradropped a Heli";
  234. uiSleep 30;
  235. Hint "";
  236.  
  237. ////////////////////////////////////////////////////////////////////////////////////////////////////
  238. //Drop 3 is a t90 - rhs_t90a_tv
  239. ////////////////////////////////////////////////////////////////////////////////////////////////////
  240.  
  241. uiSleep 1600;
  242.  
  243.     _validspot  = false;
  244.     while{!_validspot} do
  245.     {
  246.         sleep 1;
  247.         _position = [_spawnCenter,_min,_max,_mindist,_water,2000,_shoremode] call BIS_fnc_findSafePos;
  248.         _validspot  = true;
  249.  
  250.  
  251.         //Check if near another drop
  252.         // Get nearest rhs_t90a_tv
  253.         _nearOtherCrate = (nearestObjects [_position,["rhsgref_cdf_reg_uaz_dshkm"],750]) select 0;
  254.         if (!isNil "_nearOtherCrate") then
  255.         {
  256.             _nearestCrate = _position distance _nearOtherCrate;
  257.             if (_nearestCrate < 750) then
  258.             {
  259.                 _validspot = false;
  260.             };
  261.         };
  262.  
  263.         //Check if near player base
  264.         // Get nearest Exile_Construction_Flag_Static
  265.         _nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],750]) select 0;
  266.         if (!isNil "_nearBase") then
  267.         {
  268.             _nearestBase = _position distance _nearBase;
  269.             if (_nearestBase < 750) then
  270.             {
  271.                 _validspot = false;
  272.             };
  273.         };
  274.  
  275.     };
  276.  
  277.     if (_marker) then
  278.     {
  279.         _event_marker13 = createMarker [ format ["loot_marker_%1", 13], _position];
  280.         _event_marker13 setMarkerColor "ColorBlue";
  281.         _event_marker13 setMarkerAlpha 0.85;
  282.         _event_marker13 setMarkerText "Drop3";
  283.         _event_marker13 setMarkerType "loc_Tree";
  284.         _event_marker13 setMarkerBrush "Vertical";
  285.         _event_marker13 setMarkerSize [(2), (2)];
  286.     };
  287.  
  288.     diag_log format['paraDrop %1 : Location %2',13,_position];
  289.  
  290.     diag_log text format ["[paraDrop]: Creating drop zone %1",_position];
  291.  
  292. //Call function
  293. //_spawnPosition = [_position select 0, _position select 1, 300];
  294. _tank = "rhsgref_cdf_reg_uaz_dshkm" createVehicle [0,0,0];
  295. _tank setDir random 360;
  296. _tank setPos [_position select 0, _position select 1, 300];
  297. _tank call KK_fnc_paraDrop;
  298.  
  299.     diag_log format['[paraDrop] Dropped tank 3: ',_Position];
  300.  
  301.     clearMagazineCargoGlobal _tank;
  302.     clearWeaponCargoGlobal _tank;
  303.     clearItemCargoGlobal _tank;
  304.     _tank setVariable ["permaLoot",true]; //stay until reset
  305.     _tank allowDamage false; // Prevent boxes to explode when spawning
  306.  
  307.     _tank addItemCargoGlobal ["Exile_Item_DuctTape", 2 + (random 2)];
  308.     _tank addItemCargoGlobal ["Exile_Item_JunkMetal",  (random 8)];
  309.     _tank addItemCargoGlobal ["Exile_Item_MetalPole",  (random 7)];
  310.     _tank addMagazineCargoGlobal ["ClaymoreDirectionalMine_Remote_Mag", (random 2)];
  311.     _tank addItemCargoGlobal ["Exile_Item_WoodFloorKit", 2 + (random 10)];
  312.     _tank addItemCargoGlobal ["Exile_Item_WoodPlank", 1 + (random 10)];
  313.     _tank addItemCargoGlobal ["Exile_Item_WoodWallKit",  (random 7)];
  314.     _tank addItemCargoGlobal ["Exile_Item_InstaDoc", 1 + (random 2)];
  315.     _tank addItemCargoGlobal ["Exile_Item_FortificationUpgrade",  (random 4)];
  316.     _tank addItemCargoGlobal ["Exile_Item_BBQSandwich_Cooked", 1 + (random 4)];
  317.     _tank addItemCargoGlobal ["Exile_Item_Energydrink", 1 + (random 3)];
  318.     _tank addWeaponCargoGlobal ["srifle_LRR_camo_F",  (random 1)];
  319.     _tank addWeaponCargoGlobal ["rhs_weap_M107", (random 1)];
  320.     _tank addWeaponCargoGlobal ["arifle_SDAR_F", 1 + (random 1)];
  321.     _tank addMagazineCargoGlobal ["20Rnd_556x45_UW_mag",3 + (random 5)];
  322.     _tank addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", (random 1)];
  323.     _tank addItemCargoGlobal ["Exile_Item_Bandage", 1 + (random 5)];
  324.     _tank addMagazineCargoGlobal ["150Rnd_93x64_Mag", (random 2)];
  325.     _tank addMagazineCargoGlobal ["130Rnd_338_Mag", (random 2)];
  326.     _tank setVariable ["ExileMoney",10003,true]; // rod
  327.  
  328. playsound "drop";
  329. Hint "Intel: Air Support has paradropped a Tank";
  330. uiSleep 30;
  331. Hint "";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement