Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------- FIRING SEQUENCE LOOP
- while { canFire priorityObj1 || canFire priorityObj2 } do {
- scopeName "TargetingLoop";
- //reset some stuff
- _sleeptimer = 0;
- _unit = isNil;
- _targetPos = [0,0,0];
- _playerCount = 1;
- //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!
- while (_playerCount <= 3) then {sleep 30;};
- //pick the lucky basterd that's getting shot & check if he's not nothing, Blufor and not in a vehicle
- while {(isNull _unit) || !(side _unit == WEST) || !(vehicle _unit == _unit)} do {
- sleep 3;
- if (isMultiplayer) then {
- _unit = playableUnits select (floor (random (count playableUnits)));
- } else {
- _unit = switchableUnits select (floor (random (count switchableUnits)));
- };
- };
- _targetPos = getPos _unit;
- //Aren't you shooting too close to base?
- _noshooting = ["respawn_west","FOB_Martian","FOB_Marathon","FOB_Guardian","Dirt_Track","Dirt_Last_Stand","USS_Freedom"];
- while {_tooclose} do {
- _tooclose = true;
- {
- _TargetNearBaseLoc = _targetPos distance(getMarkerPos _x);
- if (_TargetNearBaseLoc < 1000) then {_tooclose = false; };
- } forEach _noshooting;
- sleep 5;
- };
- //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