startgame.sqf 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. waitUntil { time > 1 };
  2. waitUntil { !isNil "GRLIB_all_fobs" };
  3. waitUntil { !isNil "save_is_loaded" };
  4. private [ "_fobbox" ];
  5. if ( count GRLIB_all_fobs == 0 ) then {
  6. if ( GRLIB_build_first_fob ) then {
  7. _potentialplaces = [];
  8. {
  9. _nextsector = _x;
  10. _acceptsector = true;
  11. {
  12. if ( ( ( markerPos _nextsector ) distance ( markerPos _x ) ) < 800 ) then {
  13. _acceptsector = false;
  14. };
  15. } foreach sectors_allSectors;
  16. if ( _acceptsector ) then {
  17. _potentialplaces pushBack _nextsector;
  18. };
  19. } foreach sectors_opfor;
  20. _spawnplace = _potentialplaces call BIS_fnc_selectRandom;
  21. [markerPos _spawnplace, true] remoteExec ["build_fob_remote_call",2];
  22. if (IA_liberation_debug) then {private _text = format ["[IA LIBERATION] [DEBUG] Preplaced FOB placed by: %1", (name player)];_text remoteExec ["diag_log",2];};
  23. } else {
  24. while { count GRLIB_all_fobs == 0 } do {
  25. _fobbox = FOB_box_typename createVehicle (getposATL base_boxspawn);
  26. _fobbox setposATL (getposATL base_boxspawn);
  27. _fobbox setdir getDir base_boxspawn;
  28. huron setVehicleCargo _fobbox;
  29. [_fobbox, 3000] remoteExec ["F_setMass",_fobbox];
  30. if (IA_liberation_debug) then {private _text = format ["[IA LIBERATION] [DEBUG] FOB Box placed by: %1", (name player)];_text remoteExec ["diag_log",2];};
  31. sleep 3;
  32. waitUntil {
  33. sleep 1;
  34. !(alive _fobbox) || ((count GRLIB_all_fobs) > 0) || (((getPosASL _fobbox) select 2) < 0)
  35. };
  36. sleep 15;
  37. };
  38. deleteVehicle _fobbox;
  39. };
  40. waitUntil {sleep 5; (count GRLIB_all_fobs) > 0};
  41. private ["_crate","_crateArray", "_smoke"];
  42. if (IA_liberation_debug) then {private _text = format ["[IA LIBERATION] [DEBUG] First FOB built at %1. Sending resource package.", (GRLIB_all_fobs select 0)];_text remoteExec ["diag_log",2];};
  43. _crateArray = [];
  44. uiSleep 10;
  45. for [{_i = 0;}, {_i < 6}, {_i = _i + 1;}] do {
  46. _crate = createVehicle [
  47. (IA_liberation_crates select (_i % 3)),
  48. [((GRLIB_all_fobs select 0) select 0), ((GRLIB_all_fobs select 0) select 1), 150],
  49. [],
  50. 80,
  51. "FLY"
  52. ];
  53. clearWeaponCargoGlobal _crate;
  54. clearMagazineCargoGlobal _crate;
  55. clearItemCargoGlobal _crate;
  56. clearBackpackCargoGlobal _crate;
  57. _crate addMPEventHandler ['MPKilled', {_this spawn kill_manager}];
  58. _crate setVariable ["IA_liberation_crate_value", 100, true];
  59. [_crate, 500] remoteExec ["F_setMass",_crate];
  60. [objNull, _crate] call BIS_fnc_curatorObjectEdited;
  61. _crateArray pushBack _crate;
  62. };
  63. uiSleep 25;
  64. {
  65. _smoke = "SmokeShellGreen" createVehicle (getPos _x);
  66. _smoke attachTo [_x];
  67. } forEach _crateArray;
  68. if (IA_liberation_debug) then {private _text = format ["[IA LIBERATION] [DEBUG] Startresources dropped by: %1", (name player)];_text remoteExec ["diag_log",2];};
  69. };