SHARE
TWEET

Untitled

a guest Feb 26th, 2020 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Sample mission
  3.     Created by Defent and eraser1
  4.  
  5.     Called from DMS_selectMission
  6. */
  7.  
  8. private ["_num", "_side", "_OK", "_group", "_pos", "_difficulty", "_AICount", "_type", "_launcher", "_crate1", "_wreck", "_crate_loot_values1", "_missionAIUnits", "_missionObjs", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added", "_cleanup"];
  9.  
  10. // For logging purposes
  11. _num = DMS_MissionCount;
  12.  
  13.  
  14. // Set mission side
  15. _side = "bandit";
  16.  
  17.  
  18. // 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.
  19. // It also allows anybody to modify the default calling parameters easily.
  20. if ((isNil "_this") || {_this isEqualTo [] || {!(_this isEqualType [])}}) then
  21. {
  22.     _this =
  23.     [
  24.         [10,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],
  25.         [
  26.             []
  27.         ],
  28.         _this
  29.     ];
  30. };
  31.  
  32. // Check calling parameters for manually defined mission position.
  33. // This mission doesn't use "_extraParams" in any way currently.
  34. _OK = (_this call DMS_fnc_MissionParams) params
  35. [
  36.     ["_pos",[],[[]],[3]],
  37.     ["_extraParams",[]]
  38. ];
  39.  
  40. if !(_OK) exitWith
  41. {
  42.     diag_log format ["DMS ERROR :: Called MISSION guntransport.sqf with invalid parameters: %1",_this];
  43. };
  44.  
  45.  
  46. // Set general mission difficulty
  47. _difficulty = "difficult";
  48.  
  49.  
  50. // Create AI
  51. _AICount = 6 + (round (random 2));
  52.  
  53. _group =
  54. [
  55.     _pos,                   // Position of AI
  56.     _AICount,               // Number of AI
  57.     "random",               // "random","hardcore","difficult","moderate", or "easy"
  58.     "random",               // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
  59.     _side                   // "bandit","hero", etc.
  60. ] call DMS_fnc_SpawnAIGroup;
  61.  
  62.  
  63. // Create Crates
  64. _crate1 = ["Box_NATO_Wps_F",_pos] call DMS_fnc_SpawnCrate;
  65.  
  66. _wreck = createVehicle ["Land_Wreck_Van_F",[(_pos select 0) - 10, (_pos select 1),-0.2],[], 0, "CAN_COLLIDE"];
  67.  
  68. // Set crate loot values
  69. _crate_loot_values1 =
  70. [
  71.     15,     // Weapons
  72.     15,     // Items
  73.     15      // Backpacks
  74. ];
  75.  
  76.  
  77. // Define mission-spawned AI Units
  78. _missionAIUnits =
  79. [
  80.     _group      // We only spawned the single group for this mission
  81. ];
  82.  
  83. // Define mission-spawned objects and loot values
  84. _missionObjs =
  85. [
  86.     [_wreck],
  87.     [],
  88.     [[_crate1,_crate_loot_values1]]
  89. ];
  90.  
  91. // Define Mission Start message
  92. _msgStart = ['#FFFF00',"A gun transport truck has crashed. Secure the crash site!"];
  93.  
  94. // Define Mission Win message
  95. _msgWIN = ['#0080ff',"Convicts have successfully secured the area and claimed the guns for their own!"];
  96.  
  97. // Define Mission Lose message
  98. _msgLOSE = ['#FF0000',"The transport truck has been repaired and driven off!"];
  99.  
  100. // Define mission name (for map marker and logging)
  101. _missionName = "Gun Transport";
  102.  
  103. // Create Markers
  104. _markers =
  105. [
  106.     _pos,
  107.     _missionName,
  108.     _difficulty
  109. ] call DMS_fnc_CreateMarker;
  110.  
  111. // Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
  112. _time = diag_tickTime;
  113.  
  114. // Parse and add mission info to missions monitor
  115. _added =
  116. [
  117.     _pos,
  118.     [
  119.         [
  120.             "kill",
  121.             _group
  122.         ],
  123.         [
  124.             "playerNear",
  125.             [_pos,DMS_playerNearRadius]
  126.         ]
  127.     ],
  128.     [
  129.         _time,
  130.         (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
  131.     ],
  132.     _missionAIUnits,
  133.     _missionObjs,
  134.     [_missionName,_msgWIN,_msgLOSE],
  135.     _markers,
  136.     _side,
  137.     _difficulty,
  138.     []
  139. ] call DMS_fnc_AddMissionToMonitor;
  140.  
  141. // Check to see if it was added correctly, otherwise delete the stuff
  142. if !(_added) exitWith
  143. {
  144.     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];
  145.  
  146.     // 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)
  147.     _cleanup = [];
  148.     {
  149.         _cleanup pushBack _x;
  150.     } forEach _missionAIUnits;
  151.  
  152.     _cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
  153.  
  154.     {
  155.         _cleanup pushBack (_x select 0);
  156.     } foreach (_missionObjs select 2);
  157.  
  158.     _cleanup call DMS_fnc_CleanUp;
  159.  
  160.  
  161.     // Delete the markers directly
  162.     {deleteMarker _x;} forEach _markers;
  163.  
  164.  
  165.     // Reset the mission count
  166.     DMS_MissionCount = DMS_MissionCount - 1;
  167. };
  168.  
  169.  
  170. // Notify players
  171. [_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus;
  172.  
  173.  
  174.  
  175. if (DMS_DEBUG) then
  176. {
  177.     (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;
  178. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top