Jump to content
Sign in to follow this  
thedarkbird

[FINISHED] Carpetbombing script

Recommended Posts

Just a simple carpetbombing script. It's well commented, so shouldn't be too hard to understand.

Youtube video: http://www.youtube.com/watch?v=TWJX82YftUc&hd=1

//**************************************************************************************************************
//Script: carpetbomb.sqf
//Version: 0.1b
//Author: The Darkbird
//Date: 04/2011
//Usage: _null = ["startmarker", "endmarker", ripples, bombs, spreadx, spready, totaltime] execVM carpetbomb.sqf
//Example: _null = ["start", "end", 50,5,15,170, 4] execVM "carpetbomb.sqf";
//***************************************************************************************************************

//Parameters
_startmarker = _this select 0; //Marker to start bombing from
_endmarker = _this select 1; //Marker to end bombing
_ripple = _this select 2; //Number of bomb ripples
_bombs = _this select 3; //Number of bombs per ripple
_xspread = _this select 4; //Randomness in x-axis
_yspread = _this select 5; //Randomness in y-axis
_time = _this select 6; //Total time to complete the carpet bomb (indicative, due to overhead)

//Location init
_x1 = getMarkerPos _startmarker select 0; //Start x
_y1 = getMarkerPos _startmarker select 1; //Start y 
_x2 = getMarkerPos _endmarker select 0; //End x
_y2 = getMarkerPos _endmarker select 1; //End y
_z = getMarkerPos _startmarker select 2; //z, which is always the same

//Calculations
_deltax = (_x1 - _x2)/(_ripple-1); //Calculate delta x (= movement per ripple)
_deltay = (_y1 - _y2)/(_ripple-1); //Calculate delta y (= movement per ripple)
_delay = _time /_ripple; //Calculate delay between ripples

if (isServer) then //Random function is local, so only execute on server in MP
{
for [{_i=0},{_i < _ripple},{_i = _i +1}] do //For every ripple do
{
		for [{_j=0},{_j < _bombs},{_j = _j +1}] do //For every bomb do
		{
			_gbu = "Bo_Mk82" createVehicle [_x1 + (random -_xspread) + (random _xspread), _y1 + (random -_yspread)+ (random _yspread) , _z]; //Make bomb
			_gbu setDamage 1; //Detonate bomb
		};//end for every bomb
		_x1 = _x1 - _deltax; //Move x-position
		_y1 = _y1 - _deltay; //Move y-position
		sleep _delay; //Delay
};//end for ever ripple
};// end if

Edited by thedarkbird

Share this post


Link to post
Share on other sites

lol - have you got one with more bombs!

Share this post


Link to post
Share on other sites

Hmmmmmmm... for some reason it doesnt work for me!

I've done what you need to do.... create the carpetbomb.sqf and put it in the mission folder, I went in game and loaded the test mission, put down a radio trigger, put the exceVM command in the On act. area and put it as a radio command! Pushed the radio button..... and nothing!

I put down 2 empty makers, one is named "start" and the other is called "end"....

Any ideas whats wrong? (I'm not running CO)

-bigshot

EDIT: Nevermind got it to work! Just replace the provided ordnance with a GBU-12 :D

Edited by bigshotking

Share this post


Link to post
Share on other sites

Hey I can't seem to get it to work. I've copied the file into the mission folder and created a start object and end object. I also know it loads the script since I have put in a hint to check if it works. The problem is it just doesn't blow up. Note that I am activating it by the radio. Practically exactly the same as bigshot's problem, but no matter what i do it doesnt work. And also in ArmaEdit all the text is green?

Edited by barnard401

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  

×