Jump to content
Sign in to follow this  
Reid236

Random Mortar Script?

Recommended Posts

Does anyone know of a script that drops mortars randomly around players not on top of them but around them in an area?

Share this post


Link to post
Share on other sites

Here's a bit of a beefed up version of ambient arty impacts:

 

//init.sqf
GOM_fnc_spawnArtyShells = {
	params ["_impactCenter","_shellAmount","_shellType","_delayBetweenShells"];
	for "_i" from 1 to _shellAmount do {
		_rndPos = _impactCenter getPos [random [0,50,0],random 360];
		_rndPos set [2,500];
		_shell = _shellType createVehicle _rndPos;
		_shell setPosASL _rndPos;
		_shell setVectorDirAndUp [[0,0,-1],[0,0.8,0]];
		_shell setVelocityModelSpace [0,0,-70];
		sleep _delayBetweenShells;
	};
};


GOM_fnc_ambientArty = {
	params ["_centerObject","_shellType","_minDistance","_maxDistance",["_delayBetweenShells",1.5],["_delayBetweenRounds",15],["_simultaneousRounds",1],["_minShellAmount",2],["_maxShellAmount",6]];
	GOM_fnc_ambientArtyEnabled = true;
	while {GOM_fnc_ambientArtyEnabled} do {
		for "_i" from 1 to _simultaneousRounds do {
			_impactCenter = _centerObject getPos [_minDistance + random _maxDistance,random 360];
			_shellAmount = _minShellAmount + round random _maxShellAmount;
			_spawn = [_impactCenter,_shellAmount,_shellType,_delayBetweenShells] spawn GOM_fnc_spawnArtyShells;
			waitUntil {scriptDone _spawn};
			sleep _delayBetweenRounds;
		}
	};
};

//to call it:
_centerObject = player;//center object of bombing
_shellType = "Sh_82mm_AMOS";//bomb type
_minDist = 150;//minimum impact distance to center
_maxDist = 1500;//max impact distance to center
_delayBetweenShells = 2;//seconds between single shells
_delayBetweenRounds = 10;//seconds between rounds
_simultaneousRounds = 4;//number of bombings at the same time
_minShellAmount = 2;//minimum number of shells per bombing
_maxShellAmount = 6;//max number of shells per bombing

_bomb = [_centerObject,_shellType,_minDist,_maxDist,_delayBetweenShells,_delayBetweenRounds,_simultaneousRounds,_minShellAmount,_maxShellAmount] spawn GOM_fnc_ambientArty;

To make the arty stop simply set GOM_fnc_ambientArtyEnabled to false.

 

Cheers

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×