Advertisement
secondcoming

occupation.sqf

Sep 20th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 18.78 KB | None | 0 0
  1. /*
  2.     "Occupation" static mission for Altis, Chernarus, Namalsk and Taviana
  3.     Created by second_coming
  4. */
  5.  
  6. private["_wp","_wp2","_wp3","_pos","_missionName","_msgStart","_msgWIN","_msgLOSE"];
  7.  
  8. // For logging purposes
  9. private _num = DMS_MissionCount;
  10.  
  11.  
  12. // Set mission side (only "bandit" is supported for now)
  13. _side = "bandit";
  14.  
  15. switch (toLower worldName) do
  16. {
  17.     case "taviana":
  18.     {
  19.         _pos = [14000,12220,0];
  20.         _missionName = "Solibor Occupation";
  21.         _msgStart = ['#FFFF00',"Solibor is under martial law! There are reports they have a large weapon cache..."];
  22.         _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Solibor and secured the cache!"];
  23.         _msgLOSE = ['#FF0000',"The troops have left Solibor, taking the cache with them..."];
  24.     };
  25.  
  26.     case "namalsk":
  27.     {
  28.         _pos = [3926,7523,0];
  29.         _missionName = "Norinsk Occupation";
  30.         _msgStart = ['#FFFF00',"Norinsk is under martial law! There are reports they have a large weapon cache..."];
  31.         _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Norinsk and secured the cache!"];
  32.         _msgLOSE = ['#FF0000',"The troops have left Norinsk, taking the cache with them..."];
  33.     };
  34.  
  35.     case "napf":
  36.     {
  37.         _chance = floor(random 2);
  38.         switch (_chance) do
  39.         {
  40.             case 0:
  41.             {
  42.                 _pos = [8846,16066,0];
  43.                 _missionName = "Lenzburg Occupation";
  44.                 _msgStart = ['#FFFF00',"Lenzburg is under martial law! There are reports they have a large weapon cache..."];
  45.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Lenzburg and secured the cache!"];
  46.                 _msgLOSE = ['#FF0000',"The troops have left Lenzburg, taking the cache with them..."];
  47.             };
  48.             case 1:
  49.             {
  50.                 _pos = [2426,7712,0];
  51.                 _missionName = "Worb Occupation";
  52.                 _msgStart = ['#FFFF00',"Worb is under martial law! There are reports they have a large weapon cache..."];
  53.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Worb and secured the cache!"];
  54.                 _msgLOSE = ['#FF0000',"The troops have left Worb, taking the cache with them..."];
  55.             };
  56.         };
  57.     };
  58.    
  59.     case "chernarus":
  60.     {
  61.         _chance = floor(random 4);
  62.         switch (_chance) do
  63.         {
  64.             case 0:
  65.             {
  66.                 _pos = [3810,8887,0];
  67.                 _missionName = "Vybor Occupation";
  68.                 _msgStart = ['#FFFF00',"Vybor is under martial law! There are reports they have a large weapon cache..."];
  69.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Vybor and secured the cache!"];
  70.                 _msgLOSE = ['#FF0000',"The troops have left Vybor, taking the cache with them..."];
  71.             };
  72.             case 1:
  73.             {
  74.                 _pos = [12024,9083,0];
  75.                 _missionName = "Berenzio Occupation";
  76.                 _msgStart = ['#FFFF00',"Berenzio is under martial law! There are reports they have a large weapon cache..."];
  77.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Berenzio and secured the cache!"];
  78.                 _msgLOSE = ['#FF0000',"The troops have left Berenzio, taking the cache with them..."];
  79.             };
  80.             case 2:
  81.             {
  82.                 _pos = [6773,2365,0];
  83.                 _missionName = "Chernogorsk Occupation";
  84.                 _msgStart = ['#FFFF00',"Chernogorsk is under martial law! There are reports they have a large weapon cache..."];
  85.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Chernogorsk and secured the cache!"];
  86.                 _msgLOSE = ['#FF0000',"The troops have left Chernogorsk, taking the cache with them..."];
  87.             };
  88.             case 3:
  89.             {
  90.                 _pos = [6079.98,7789,0];
  91.                 _missionName = "Stary Sobar Occupation";
  92.                 _msgStart = ['#FFFF00',"Stary Sobar is under martial law! There are reports they have a large weapon cache..."];
  93.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Stary Sobar and secured the cache!"];
  94.                 _msgLOSE = ['#FF0000',"The troops have left Stary Sobar, taking the cache with them..."];
  95.             };
  96.         };
  97.     };
  98.    
  99.     case "altis":
  100.     {
  101.         _chance = floor(random 5);
  102.         switch (_chance) do
  103.         {
  104.             case 0:
  105.             {
  106.                 _pos = [12571,14337,0];
  107.                 _missionName = "Neochori Occupation";
  108.                 _msgStart = ['#FFFF00',"Neochori is under martial law! There are reports they have a large weapon cache..."];
  109.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Neochori and secured the cache!"];
  110.                 _msgLOSE = ['#FF0000',"The troops have left Neochori, taking the cache with them..."];
  111.             };
  112.             case 1:
  113.             {
  114.                 _pos = [3679,13048,0];
  115.                 _missionName = "Kavala Occupation";
  116.                 _msgStart = ['#FFFF00',"Kavala is under martial law! There are reports they have a large weapon cache..."];
  117.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Kavala and secured the cache!"];
  118.                 _msgLOSE = ['#FF0000',"The troops have left Kavala, taking the cache with them..."];
  119.             };
  120.             case 2:
  121.             {
  122.                 _pos = [16812,12610,0];
  123.                 _missionName = "Pyrgos Occupation";
  124.                 _msgStart = ['#FFFF00',"Pyrgos is under martial law! There are reports they have a large weapon cache..."];
  125.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Pyrgos and secured the cache!"];
  126.                 _msgLOSE = ['#FF0000',"The troops have left Pyrgos, taking the cache with them..."];
  127.             };
  128.             case 3:
  129.             {
  130.                 _pos = [20885,16947,0];
  131.                 _missionName = "Paros Occupation";
  132.                 _msgStart = ['#FFFF00',"Paros is under martial law! There are reports they have a large weapon cache..."];
  133.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Paros and secured the cache!"];
  134.                 _msgLOSE = ['#FF0000',"The troops have left Paros, taking the cache with them..."];
  135.             };
  136.             case 4:
  137.             {
  138.                 _pos = [25764,21344,0];
  139.                 _missionName = "Sofia Occupation";
  140.                 _msgStart = ['#FFFF00',"Sofia is under martial law! There are reports they have a large weapon cache..."];
  141.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Sofia and secured the cache!"];
  142.                 _msgLOSE = ['#FF0000',"The troops have left Sofia, taking the cache with them..."];
  143.             };
  144.         };
  145.     };
  146.    
  147.     case "esseker":
  148.     {
  149.         _chance = floor(random 4);
  150.         switch (_chance) do
  151.         {
  152.             case 0:
  153.             {
  154.                 _pos = [1120,10279,0];
  155.                 _missionName = "Camp Spencer Occupation";
  156.                 _msgStart = ['#FFFF00',"Camp Spencer is under bandit control! There are reports they have a large weapon cache..."];
  157.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted Camp Spencer and secured the cache!"];
  158.                 _msgLOSE = ['#FF0000',"The Bandits have left Camp Spencer, taking the cache with them..."];
  159.             };
  160.             case 1:
  161.             {
  162.                 _pos = [11932,7920,0];
  163.                 _missionName = "Novi Grad Occupation";
  164.                 _msgStart = ['#FFFF00',"Novi Grad is under bandit control! There are reports they have a large weapon cache..."];
  165.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Novi Grad and secured the cache!"];
  166.                 _msgLOSE = ['#FF0000',"The Bandits have left Novi Grad, taking the cache with them..."];
  167.             };
  168.             case 2:
  169.             {
  170.                 _pos = [8771,5438,0];
  171.                 _missionName = "Old Essker Raid";
  172.                 _msgStart = ['#FFFF00',"Old Essker is Being occupied by bandits! There are reports they have a large weapon cache..."];
  173.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the Old Essker Ruins and secured the cache!"];
  174.                 _msgLOSE = ['#FF0000',"The bandits have left the Old Essker Ruins, taking the cache with them..."];
  175.             };
  176.             case 3:
  177.             {
  178.                 _pos = [4493,3597,0];
  179.                 _missionName = "Petlov Grad Park Occupation";
  180.                 _msgStart = ['#FFFF00',"Petlov Grad Park is under bandits Occupation! There are reports they have a large weapon cache..."];
  181.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the Park and secured the cache!"];
  182.                 _msgLOSE = ['#FF0000',"The bandits have left Petlov Grad Park, taking the cache with them..."];
  183.             };
  184.         };
  185.     }; 
  186.    
  187.     case "tanoa":
  188.     {
  189.         _chance = floor(random 7);
  190.         switch (_chance) do
  191.         {
  192.             case 0:
  193.             {
  194.                 _pos = [11621,2648,0];
  195.                 _missionName = "Lijnhaven Occupation";
  196.                 _msgStart = ['#FFFF00',"Lijnhaven is under martial law! There are reports they have a large weapon cache..."];
  197.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Lijnhaven and secured the cache!"];
  198.                 _msgLOSE = ['#FF0000',"The troops have left Lijnhaven, taking the cache with them..."];
  199.             };
  200.             case 1:
  201.             {
  202.                 _pos = [5850,10216,0];
  203.                 _missionName = "Georgetown Occupation";
  204.                 _msgStart = ['#FFFF00',"Georgetown is under martial law! There are reports they have a large weapon cache..."];
  205.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Georgetown and secured the cache!"];
  206.                 _msgLOSE = ['#FF0000',"The troops have left Georgetown, taking the cache with them..."];
  207.             };
  208.             case 2:
  209.             {
  210.                 _pos = [8414,10331,0];
  211.                 _missionName = "Suger Company Raid";
  212.                 _msgStart = ['#FFFF00',"Tanoa Suger Company is Being Raided by bandits! There are reports they have a large weapon cache..."];
  213.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the Suger Company and secured the cache!"];
  214.                 _msgLOSE = ['#FF0000',"The troops have left the Suger Company, taking the cache with them..."];
  215.             };
  216.             case 3:
  217.             {
  218.                 _pos = [13446,12303,0];
  219.                 _missionName = "Blue Pearl Industrial Raid";
  220.                 _msgStart = ['#FFFF00',"Blue Pearl Industrial is Being Raided by bandits! There are reports they have a large weapon cache..."];
  221.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the Blue Pearl Industrial Complex and secured the cache!"];
  222.                 _msgLOSE = ['#FF0000',"The troops have left the Blue Pearl Complex, taking the cache with them..."];
  223.             };
  224.             case 4:
  225.             {
  226.                 _pos = [1812,13278,0];
  227.                 _missionName = "Forbidden Village Occupation";
  228.                 _msgStart = ['#FFFF00',"Forbidden Village is under Bandit Occupation! There are reports they have a large weapon cache..."];
  229.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted the Forbidden Village and secured the cache!"];
  230.                 _msgLOSE = ['#FF0000',"The Bandits have left the Forbidden Village, taking the cache with them..."];
  231.             };
  232.             case 5:
  233.             {
  234.                 _pos = [10032,11796,0];
  235.                 _missionName = "Comms ALPHA Occupation";
  236.                 _msgStart = ['#FFFF00',"Comms ALPHA is under Bandit Occupation! There are reports they have a large weapon cache..."];
  237.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted Comms ALPHA and secured the cache!"];
  238.                 _msgLOSE = ['#FF0000',"The Bandits have left Comms ALPHA, taking the cache with them..."];
  239.             };
  240.             case 6:
  241.             {
  242.                 _pos = [11157,11501,0];
  243.                 _missionName = "Comms BRAVO Occupation";
  244.                 _msgStart = ['#FFFF00',"Comms BRAVO is under Bandit Occupation! There are reports they have a large weapon cache..."];
  245.                 _msgWIN = ['#0080FF',"Convicts have successfully assaulted Comms BRAVO and secured the cache!"];
  246.                 _msgLOSE = ['#FF0000',"The Bandits have left Comms BRAVO, taking the cache with them..."];
  247.             };
  248.         };
  249.     };         
  250.     default
  251.     {
  252.         diag_log format["DMS ERROR :: Attempting to run occupation with unsupported map: %1",worldName];
  253.     };
  254. };
  255.  
  256. if (isNil "_pos") exitWith {};
  257.  
  258. if ([_pos,DMS_StaticMinPlayerDistance] call DMS_fnc_IsPlayerNearby) exitWith {"delay"};
  259.  
  260. diag_log text "[DMS]: Town Occupation Mission Started";
  261.  
  262.  
  263. // Set general mission difficulty
  264. _difficulty = "hardcore";
  265.  
  266.  
  267. // Create AI
  268. _AICount        = 27;
  269. _group1Count    = ceil(_AICount/3);
  270. _group2Count    = ceil(_AICount/3);
  271. _group3Count    = ceil(_AICount/3);
  272.  
  273. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  274. // Get AI to defend the position
  275. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  276. _group = [_pos, _group1Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
  277. [ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior;
  278.  
  279. _buildings = _pos nearObjects ["building", 200];
  280. {
  281.     _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
  282.     if(count _buildingPositions > 0) then
  283.     {
  284.         _y = _x;
  285.         // Find Highest Point
  286.         _highest = [0,0,0];
  287.         {
  288.             if(_x select 2 > _highest select 2) then
  289.             {
  290.                 _highest = _x;
  291.             };
  292.  
  293.         } foreach _buildingPositions;
  294.         _spawnPosition = _highest;
  295.  
  296.         _i = _buildingPositions find _spawnPosition;
  297.         _wp = _group addWaypoint [_spawnPosition,0] ;
  298.         _wp setWaypointFormation "Column";
  299.         _wp setWaypointBehaviour "AWARE";
  300.         _wp setWaypointCombatMode "RED";
  301.         _wp setWaypointCompletionRadius 1;
  302.         _wp waypointAttachObject _y;
  303.         _wp setwaypointHousePosition _i;
  304.         _wp setWaypointType "MOVE";
  305.  
  306.     };
  307.  
  308. } foreach _buildings;
  309. if(count _buildings > 0 ) then
  310. {
  311.     _wp setWaypointType "CYCLE";
  312. };
  313.  
  314.  
  315. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  316. _group2 = [ _pos, _group2Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
  317. [ _group2,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior;
  318.  
  319. _buildings = _pos nearObjects ["building", 100];
  320. {
  321.     _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
  322.     if(count _buildingPositions > 0) then
  323.     {
  324.         _y = _x;
  325.         // Find Highest Point
  326.         _highest = [0,0,0];
  327.         {
  328.             if(_x select 2 > _highest select 2) then
  329.             {
  330.                 _highest = _x;
  331.             };
  332.  
  333.         } foreach _buildingPositions;
  334.         _spawnPosition = _highest;
  335.  
  336.         _i = _buildingPositions find _spawnPosition;
  337.         _wp2 = _group2 addWaypoint [_spawnPosition,0] ;
  338.         _wp2 setWaypointFormation "Column";
  339.         _wp2 setWaypointBehaviour "AWARE";
  340.         _wp2 setWaypointCombatMode "RED";
  341.         _wp2 setWaypointCompletionRadius 1;
  342.         _wp2 waypointAttachObject _y;
  343.         _wp2 setwaypointHousePosition _i;
  344.         _wp2 setWaypointType "MOVE";
  345.     };
  346.  
  347. } foreach _buildings;
  348. if(count _buildings > 0 ) then
  349. {
  350.     _wp2 setWaypointType "CYCLE";
  351. };
  352.  
  353. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  354. _group3 = [_pos, _group3Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
  355. [ _group3,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior;
  356.  
  357. _buildings = _pos nearObjects ["building", 100];
  358. {
  359.     _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
  360.     if(count _buildingPositions > 0) then
  361.     {
  362.         _y = _x;
  363.         // Find Highest Point
  364.         _highest = [0,0,0];
  365.         {
  366.             if(_x select 2 > _highest select 2) then
  367.             {
  368.                 _highest = _x;
  369.             };
  370.  
  371.         } foreach _buildingPositions;
  372.         _spawnPosition = _highest;
  373.  
  374.         _i = _buildingPositions find _spawnPosition;
  375.         _wp3 = _group2 addWaypoint [_spawnPosition,0] ;
  376.         _wp3 setWaypointFormation "Column";
  377.         _wp3 setWaypointBehaviour "AWARE";
  378.         _wp3 setWaypointCombatMode "RED";
  379.         _wp3 setWaypointCompletionRadius 1;
  380.         _wp3 waypointAttachObject _y;
  381.         _wp3 setwaypointHousePosition _i;
  382.         _wp3 setWaypointType "MOVE";
  383.  
  384.     };
  385.  
  386. } foreach _buildings;
  387. if(count _buildings > 0 ) then
  388. {
  389.     _wp3 setWaypointType "CYCLE";
  390. };
  391.  
  392. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  393.  
  394. // Get the AI to shut the fuck up :)
  395. enableSentences false;
  396. enableRadio false;
  397.  
  398. // Create Crate
  399. _crate = ["I_CargoNet_01_ammo_F",_pos] call DMS_fnc_SpawnCrate;
  400.  
  401.  
  402. // Define mission-spawned AI Units
  403. _missionAIUnits =
  404. [
  405.     [_group,_group2,_group3]
  406. ];
  407.  
  408. // Define the group reinforcements
  409. _groupReinforcementsInfo = [];
  410.  
  411. // Define mission-spawned objects and loot values
  412. _missionObjs =
  413. [
  414.     [_missionAIUnits],          // armed AI vehicle and static gun(s). Note, we don't add the base itself because we don't want to delete it and respawn it if the mission respawns.
  415.     [],
  416.     [[_crate,[30 + (random 20),100 + (random 40),15 + (random 5)]]]         // weapons,items,backpacks
  417. ];
  418.  
  419. // Create Markers
  420. _markers =
  421. [
  422.     _pos,
  423.     _missionName,
  424.     _difficulty
  425. ] call DMS_fnc_CreateMarker;
  426.  
  427. (_markers select 1) setMarkerSize [500,500];
  428.  
  429. // Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
  430. _time = diag_tickTime;
  431.  
  432. // Parse and add mission info to missions monitor
  433. _added =
  434. [
  435.     _pos,
  436.     [
  437.         [
  438.             "kill",
  439.             [_group,_group2,_group3]
  440.         ],
  441.         [
  442.             "playerNear",
  443.             [_pos,100]
  444.         ]
  445.     ],
  446.     _groupReinforcementsInfo,
  447.     [
  448.         _time,
  449.         DMS_StaticMissionTimeOut call DMS_fnc_SelectRandomVal
  450.     ],
  451.     _missionAIUnits,
  452.     _missionObjs,
  453.     [_missionName,_msgWIN,_msgLOSE],
  454.     _markers,
  455.     _side,
  456.     _difficulty,
  457.     [[],[]]
  458. ] call DMS_fnc_AddMissionToMonitor_Static;
  459.  
  460. // Check to see if it was added correctly, otherwise delete the stuff
  461. if !(_added) exitWith
  462. {
  463.     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];
  464.  
  465.     _cleanup = [];
  466.     {
  467.         _cleanup pushBack _x;
  468.     } forEach _missionAIUnits;
  469.  
  470.     _cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
  471.  
  472.     {
  473.         _cleanup pushBack (_x select 0);
  474.     } foreach (_missionObjs select 2);
  475.  
  476.     _cleanup call DMS_fnc_CleanUp;
  477.  
  478.  
  479.     // Delete the markers directly
  480.     {deleteMarker _x;} forEach _markers;
  481.  
  482.  
  483.     // Reset the mission count
  484.     DMS_MissionCount = DMS_MissionCount - 1;
  485. };
  486.  
  487.  
  488. // Notify players
  489. [_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus;
  490.  
  491. if (DMS_DEBUG) then
  492. {
  493.     (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;
  494. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement