Guest User

Untitled

a guest
Dec 10th, 2015
76
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. DayZ Mission System Timer by Vampire
  3. Based on fnc_hTime by TAW_Tonic and SMFinder by Craig
  4. This function is launched by the Init and runs continuously.
  5. */
  6. private["_run","_timeDiff","_timeVar","_wait","_cntMis","_ranMis","_varName"];
  7.  
  8. //Let's get our time Min and Max
  9. _timeDiff = DZMSMinorMax - DZMSMinorMin;
  10. _timeVar = _timeDiff + DZMSMinorMin;
  11.  
  12. diag_log text format ["[DZMS]: Minor Mission Clock Starting!"];
  13.  
  14. //Lets get the loop going
  15. _run = true;
  16. while {_run} do
  17. {
  18. //Lets wait the random time
  19. _wait = round(random _timeVar);
  20. [_wait,5] call DZMSSleep;
  21.  
  22. //Let's check that there are missions in the array.
  23. //If there are none, lets end the timer.
  24. _cntMis = count DZMSMinorArray;
  25. if (_cntMis == 0) then { _run = false; };
  26.  
  27. //Lets pick a mission
  28. _ranMis = floor (random _cntMis);
  29. _varName = DZMSMinorArray select _ranMis;
  30.  
  31. // clean up all the existing units before starting a new one
  32. {if (alive _x) then {_x call DZMSPurgeObject;};} forEach DZMSUnitsMinor;
  33.  
  34. // rebuild the array for the next mission
  35. DZMSUnitsMinor = [];
  36.  
  37. //Let's Run the Mission
  38. [] execVM format ["\z\addons\dayz_server\DZMS\Missions\Minor\%1.sqf",_varName];
  39. diag_log text format ["[DZMS]: Running Minor Mission %1.",_varName];
  40.  
  41. //Let's wait for it to finish or timeout
  42. if(count _dzmsmindone > 0) then
  43. {
  44. DZMSMinDone = false;
  45. };;
  46. };
RAW Paste Data