Skip to content

Commit

Permalink
fixes in artillery, use params and new cba func
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuel committed Jan 8, 2016
1 parent 9ccd35a commit 24570c6
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions FP_Template.VR/xtra/scripts/artillery.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
Function: Artillery
API:
Server
Server
Description:
Fires artillery within a trigger
Parameters:
_target - Trigger to fire within
_nrBarrages - Amount barrages [Default: 1]
_nrRounds - Amount of rounds per barrage [Default: 3]
_nrBarrages - Amount barrages [Default: 1]
_travelTime - Travel time for rounds to splash [Default: 20]
_travelTime - Travel time for rounds to splash [Default: 5]
Examples:
(begin example)
Expand All @@ -22,34 +22,34 @@
Cuel 2015-01-07
*/

private ["_target","_nrRounds","_nrBarrages","_travelTime","_ammo","_spawnHeight","_pos","_exit","_tmppos"];
private ["_target","_nrRounds","_nrBarrages","_travelTime","_ammo","_spawnHeight","_pos","_tmppos"];

_target = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_nrRounds = [_this,1,3,[0]] call BIS_fnc_param;
_nrBarrages = [_this,2,1,[0]] call BIS_fnc_param;
_travelTime = [_this,3,20,[0]] call BIS_fnc_param;
params [
["_target", objNull],
["_nrBarrages", 1],
["_nrRounds", 3],
["_travelTime", 5]
];
if (isNull _target) exitWith {["ARTILLERY.SQF: Trigger is null! ",_this] call BIS_fnc_error; false};

_dist = (triggerArea _target select 0) max (triggerArea _target select 1);
_ammo = "Sh_82mm_AMOS";
_spawnHeight = 200;
_spawnHeight = 250;

for "_i" from 1 to _nrBarrages do {
sleep _travelTime;
for "_y" from 1 to _nrRounds do {
_exit = false;
_pos = getPosATL _target;
for "_z" from 0 to 20 do {
_tmppos = [_pos,_dist] call CBA_fnc_randPos;
if ([_target,_tmppos] call BIS_fnc_inTrigger) exitWith {
_pos = _tmppos;
};
};
_pos = [_target] call CBA_fnc_randPosArea;
_pos set [2,_spawnHeight];
_bomb = createVehicle [_ammo,_pos, [], 0, "NONE"];
sleep 0.1;
_bomb setVectorDirAndUp [[0,0,-1],[0,1,0]];
_bomb setVelocity [0,0,-200];
player sideChat str _y;
if (_y == 1 || (random 1 < 0.4)) then {
(["mortar1", "mortar2"] select (random 1 > 0.5))
remoteExecCall ["playSound", [allPlayers, {_x distance [_pos select 0, _pos select 1, 0] < 100}] call ACE_common_fnc_filter];
};
sleep 0.1;
_bomb = createVehicle [_ammo, _pos, [], 0, "NONE"];
_bomb setVectorDirAndUp [[0,0,-1],[0,1,0]];
_bomb setVelocity [0,0,-100];
sleep 3+(random 3);
};
};
Expand Down

0 comments on commit 24570c6

Please sign in to comment.