Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while { canFire priorityObj1 || canFire priorityObj2 } do {
- scopeName "TargetingLoop";
- //reset some stuff
- _sleeptimer = 0;
- _unit = objNull;
- _targetPos = [0,0,0];
- _playerCount = 1;
- _failsleep = 0;
- //Quartermaster_4 sideChat "debug";
- //fall back to loop
- while {true} do {scopeName "fallback"; Quartermaster_4 sideChat "starting to sleep"; sleep _failsleep; Quartermaster_4 sideChat "slept"; breakto"TargetingLoop";};
- Quartermaster_4 sideChat "broken out of fallback";
- //count the number of people on
- if (isMultiplayer) then {
- _playerCount = count playableUnits;
- } else {
- _playerCount = count switchableUnits;
- };
- //don't be cruel to those 2 peeps on the server!
- if (_playerCount <= 0) then {_failsleep = 30; breakTo "fallback";};
- Quartermaster_4 sideChat "enough players";
- //pick the lucky basterd that's getting shot
- if (isMultiplayer) then {
- _unit = playableUnits select (floor (random (count playableUnits)));
- } else {
- _unit = switchableUnits select (floor (random (count switchableUnits)));
- };
- Quartermaster_4 sideChat "selected a random unit";
- //just checking if what we're shooting at is: blufor, not in a vehicle and not nothing. If any of those is not true go back and try again
- if ((isNull _unit) || !(side _unit == WEST) || !(vehicle _unit == _unit)) then {_failsleep = 10; breakTo "fallback";};
- _targetPos = getPos _unit;
- //Aren't you shooting too close to base?
- _noshooting = ["respawn_west","FOB_neptune","USS_Freedom"];
- {
- _TargetNearBaseLoc = _targetPos distance(getMarkerPos _x);
- if (_TargetNearBaseLoc < 1000) then {_failsleep = 5; Quartermaster_4 sideChat "too close to something"; breakTo "fallback";};
- } forEach _noshooting;
- Quartermaster_4 sideChat "start shooting at him";
- //Look what you're shooting dammit!
- _dir = [_flatPos, _targetPos] call BIS_fnc_dirTo;
- { _x setDir _dir; } forEach [priorityObj1, priorityObj2];
- //let's fire this baby
- {
- if (alive _x) then {
- [_x,_targetPos] call AW_fnc_artyStrike;
- };
- } forEach [priorityObj1,priorityObj2];
- //let's put it to sleep so people don't get spammed
- while {_sleeptimer < PARAMS_ArtilleryTargetTickTimeMin} do {
- _timeToSleep = (PARAMS_ArtilleryTargetTickTimeMin/(5 + random 5));
- _sleeptimer = _sleeptimer + _timeToSleep;
- if (_sleeptimer > PARAMS_ArtilleryTargetTickTimeMax) exitwith {};
- if ( !(canFire priorityObj1) || !(canFire priorityObj2) ) exitwith {breakOut "TargetingLoop";};
- sleep _timeToSleep;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement