Advertisement
KRDucky

Mad Scientist

Sep 7th, 2015
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. // @file Version: 1.0
  2. // @file Name: mission_Outpost.sqf
  3. // @file Author: [404] Deadbeat, [404] Costlyy
  4. // @file Created: 08/12/2012 03:25
  5. // @file Args:
  6. #include "setup.sqf"
  7. #include "mainMissionDefines.sqf";
  8.  
  9. if(!isServer) exitwith {};
  10. private ["_obj", "_rep1", "_rep2", "_rep3", "_rep4", "_result","_missionMarkerName","_missionType","_startTime","_returnData","_randomPos","_randomIndex","_badWeather", "_origFog", "_origRain", "_origOvercast", "_hint","_currTime","_playerPresent","_unitsAlive"];
  11.  
  12. //Mission Initialization.
  13. _result = 0;
  14. _missionMarkerName = "MadScience_Marker";
  15. _missionType = "Defeat Mad Scientist";
  16. #ifdef __A2NET__
  17. _startTime = floor(netTime);
  18. #else
  19. _startTime = floor(time);
  20. #endif
  21.  
  22.  
  23. //Get Mission Location
  24. _returnData = call createMissionLocation;
  25. _randomPos = _returnData select 0;
  26. _randomIndex = _returnData select 1;
  27.  
  28. diag_log format["WASTELAND SERVER - Main Mission Waiting to run: %1",_missionType];
  29. [mainMissionDelayTime] call createWaitCondition;
  30. diag_log format["WASTELAND SERVER - Main Mission Resumed: %1",_missionType];
  31.  
  32. [_missionMarkerName,_randomPos,_missionType] call createClientMarker;
  33.  
  34. _hint = parseText format ["<t align='center' color='%2' shadow='2' size='1.75'>Main Objective</t><br/><t align='center' color='%2'>------------------------------</t><br/><t align='center' color='%3' size='1.25'>%1</t><br/><t align='center' color='%3'>Recent weather trends may be artificially created! Investigate!</t>", _missionType, mainMissionColor, subTextColor];
  35. [nil,nil,rHINT,_hint] call RE;
  36.  
  37. _origFog = fog;
  38. _origOvercast = overcast;
  39. _origRain = rain;
  40.  
  41. _obj = createVehicle ["Satelit",_randomPos,[], 0,"None"];
  42. _obj setVariable ["faction", "WORLD", true];
  43.  
  44. _rep1 = createVehicle ["Suitcase", [_randomPos select 0, (_randomPos select 1) + 5],[], 0,"None"];
  45. _rep1 setVariable ["faction", "WORLD", true];
  46.  
  47. rep2 = createVehicle ["Suitcase", [(_randomPos select 0) +5, _randomPos select 1],[], 0,"None"];
  48. _rep2 setVariable ["faction", "WORLD", true];
  49.  
  50. rep3 = createVehicle ["Suitcase", [(_randomPos select 0) -5, _randomPos select 1],[], 0,"None"];
  51. _rep3 setVariable ["faction", "WORLD", true];
  52.  
  53. rep4 = createVehicle ["Suitcase", [_randomPos select 0, (_randomPos select 1) -5],[], 0,"None"];
  54. _rep4 setVariable ["faction", "WORLD", true];
  55.  
  56.  
  57.  
  58. _obj setVehicleInit "0 setOverCast .95; 0 setFog .95; 0 setRain .95;";
  59. processInitCommands;
  60.  
  61.  
  62. CivGrpM = createGroup civilian;
  63. [CivGrpM,_randomPos] spawn createScienceGroup;
  64.  
  65. diag_log format["WASTELAND SERVER - Main Mission Waiting to be Finished: %1",_missionType];
  66. #ifdef __A2NET__
  67. _startTime = floor(netTime);
  68. #else
  69. _startTime = floor(time);
  70. #endif
  71. waitUntil
  72. {
  73. sleep 1;
  74. _playerPresent = false;
  75. #ifdef __A2NET__
  76. _currTime = floor(netTime);
  77. #else
  78. _currTime = floor(time);
  79. #endif
  80. if(_currTime - _startTime >= mainMissionTimeout) then {_result = 1;};
  81. _unitsAlive = ({alive _x} count units CivGrpM);
  82. (_result == 1) OR (_unitsAlive < 1)
  83. };
  84.  
  85. if(_result == 1) then
  86. {
  87. //Mission Failed.
  88. {deleteVehicle _x;}forEach units CivGrpM;
  89. deleteGroup CivGrpM;
  90. deleteVehicle _obj;
  91.  
  92. _rep1 setVehicleInit "0 setOverCast .5; 0 setFog .15; 0 setRain 0;";
  93. processInitCommands;
  94.  
  95. deleteVehicle _rep1;
  96. deleteVehicle _rep2;
  97. deleteVehicle _rep3;
  98. deleteVehicle _rep4;
  99.  
  100. _hint = parseText format ["<t align='center' color='%3' shadow='2' size='1.75'>Objective Failed</t><br/><t align='center' color='%3'>------------------------------</t><br/><t align='center' color='%4' size='1.25'>%1</t><br/><t align='center' color='%4'>Objective failed, better luck next time</t>", _missionType, _vehicleName, failMissionColor, subTextColor];
  101. [nil,nil,rHINT,_hint] call RE;
  102. diag_log format["WASTELAND SERVER - Main Mission Failed: %1",_missionType];
  103. } else {
  104. //Mission Complete.
  105. deleteGroup CivGrpM;
  106. _rep1 setVehicleInit "0 setOverCast .15; 0 setFog .15; 0 setRain 0;";
  107. processInitCommands;
  108.  
  109. _hint = parseText format ["<t align='center' color='%3' shadow='2' size='1.75'>Objective Complete</t><br/><t align='center' color='%3'>------------------------------</t><br/><t align='center' color='%4' size='1.25'>%1</t><br/><t align='center' color='%4'>The mad scientist has been stopped. Enjoy the weather!</t>", _missionType, _vehicleName, successMissionColor, subTextColor];
  110. [nil,nil,rHINT,_hint] call RE;
  111. diag_log format["WASTELAND SERVER - Main Mission Success: %1",_missionType];
  112. };
  113.  
  114. //Reset Mission Spot.
  115. MissionSpawnMarkers select _randomIndex set[1, false];
  116. [_missionMarkerName] call deleteClientMarker;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement