Spartaner_v1

classes

Mar 3rd, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.74 KB | None | 0 0
  1. // getNearestObject
  2. private ["_pos", "_str", "_rad", "_syn", "_merg", "_obj"];
  3.  
  4. _pos = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
  5. _str = [_this, 1, objNull, [objNull]] call BIS_fnc_param;
  6. _rad = [_this, 2, objNull, [objNull]] call BIS_fnc_param;
  7.  
  8. _syn = [_str] call JSC_fnc_getSynObjects;
  9.  
  10. _merg = [];
  11.  
  12. {
  13.     _z = _x;
  14.     _objs = nearestObjects [_pos, _z, _rad];
  15.     {
  16.         _merg = _marg append [_x];
  17.     } forEach _z;
  18. } forEach _syn;
  19.  
  20. if((count _merg) < 1) exitWith {};
  21. _obj = (_merg select 0);
  22.  
  23. {
  24.     if(((getPos _obj) distanceSqr _pos) > ((getPos _x) distanceSqr _pos)) then
  25.     {
  26.         _obj = _x;
  27.     };
  28. } forEach _merg;
  29.  
  30. return _x;
  31.  
  32.  
  33.  
  34.  
  35. // getNearestObjects
  36. private ["_pos", "_str", "_rad", "_syn", "_merg", "_obj"];
  37.  
  38. _pos = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
  39. _str = [_this, 1, objNull, [objNull]] call BIS_fnc_param;
  40. _rad = [_this, 2, objNull, [objNull]] call BIS_fnc_param;
  41.  
  42. _syn = [_str] call JSC_fnc_getSynObjects;
  43.  
  44. _merg = [];
  45.  
  46. {
  47.     _z = _x;
  48.     _objs = nearestObjects [_pos, _z, _rad];
  49.     {
  50.         _merg = _merg append [_x];
  51.     } forEach _z;
  52. } forEach _syn;
  53.  
  54. return _merg;
  55.  
  56. // callRearm
  57. private ["_obj", "_type", "_tur", "_mag"];
  58.  
  59. _obj = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
  60. _type = typeOf _obj;
  61.  
  62. _obj vehicleChat "Service: Rearming ...";
  63.  
  64. _mag = getArray(configFile >> "CfgVehicles" >> _type >> "magazines");
  65. _tur = getArray(configFile >> "CfgVehicles" >> _type >> "turrets");
  66.  
  67.  
  68. {
  69.     _mt = _x;
  70.     for "_i" from -1 to ((count _tur) - 1) do
  71.     {
  72.         _obj removeMagazinesTurret [_mt, [_i]];
  73.     };
  74. } forEach _mag;
  75.  
  76. if ((count _mag) > 0)
  77. {
  78.     {
  79.         _obj vehicleChat format ["Service: Rearming %1", _x];
  80.         sleep 1;
  81.         _obj addMagazine _x;
  82.     } forEach _mag;
  83. };
  84.  
  85. _obj vehicleChat "Service: Full Rearmed (100%)";
Advertisement
Add Comment
Please, Sign In to add comment