Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.01 KB | None | 0 0
  1. //-------------------- FIRING SEQUENCE LOOP
  2.  
  3. while { canFire priorityObj1 || canFire priorityObj2 } do {
  4.     scopeName "TargetingLoop";
  5.    
  6.     //reset some stuff
  7.     _sleeptimer = 0;
  8.     _unit = isNil;
  9.     _targetPos = [0,0,0];
  10.     _playerCount = 1;
  11.  
  12.     //count the number of people on
  13.     if (isMultiplayer) then {
  14.         _playerCount = count playableUnits;
  15.     } else {
  16.         _playerCount = count switchableUnits;
  17.     };
  18.    
  19.     //don't be cruel to those 2 peeps on the server!
  20.     while (_playerCount <= 3) then {sleep 30;};
  21.    
  22.     //pick the lucky basterd that's getting shot & check if he's not nothing, Blufor and not in a vehicle
  23.     while {(isNull _unit) || !(side _unit == WEST) || !(vehicle _unit == _unit)} do {
  24.         sleep 3;
  25.         if (isMultiplayer) then {
  26.             _unit = playableUnits select (floor (random (count playableUnits)));
  27.         } else {
  28.             _unit = switchableUnits select (floor (random (count switchableUnits)));
  29.         };
  30.     };
  31.    
  32.     _targetPos = getPos _unit;
  33.    
  34.     //Aren't you shooting too close to base?
  35.     _noshooting = ["respawn_west","FOB_Martian","FOB_Marathon","FOB_Guardian","Dirt_Track","Dirt_Last_Stand","USS_Freedom"];
  36.     while {_tooclose} do {
  37.         _tooclose = true;
  38.         {
  39.             _TargetNearBaseLoc = _targetPos distance(getMarkerPos _x);
  40.             if (_TargetNearBaseLoc < 1000) then {_tooclose = false; };
  41.         } forEach _noshooting;
  42.         sleep 5;
  43.     };
  44.    
  45.     //Look what you're shooting dammit!
  46.     _dir = [_flatPos, _targetPos] call BIS_fnc_dirTo;
  47.     { _x setDir _dir; } forEach [priorityObj1, priorityObj2];
  48.  
  49.     //let's fire this baby
  50.     {
  51.         if (alive _x) then {
  52.             [_x,_targetPos] call AW_fnc_artyStrike;
  53.         };
  54.     } forEach [priorityObj1,priorityObj2];
  55.    
  56.     //let's put it to sleep so people don't get spammed
  57.     while {_sleeptimer < PARAMS_ArtilleryTargetTickTimeMin} do {
  58.     _timeToSleep = (PARAMS_ArtilleryTargetTickTimeMin/(5 + random 5));
  59.     _sleeptimer = _sleeptimer + _timeToSleep;
  60.     if (_sleeptimer > PARAMS_ArtilleryTargetTickTimeMax) exitwith {};
  61.     if ( !(canFire priorityObj1) || !(canFire priorityObj2) ) exitwith {breakOut "TargetingLoop";};
  62.     sleep _timeToSleep;
  63.     }; 
  64. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement