Jump to content
Sign in to follow this  
wokstation

Script:  Artillery barrage

Recommended Posts

I needed an artillery strike for a mission I'm working on, and I thought I'd share my results.

This script'll launch an artillery barrage on an area surrounding a given target ("esd_l1", which must exist in the mission) continuously until the barrage flag ("esd_barrage") is set =< 0 by an outside command (eg, a trigger, script or waypoint completion).

Radius of the strike area can be adjusted by changing the value of "esd_brange", rate-of-fire by changing "esd_bdelay" (which is randomly adjusted to prevent a steady rhythm).

I'm also interested in suggestions for other munitions to drop biggrin_o.gif

(.sqf)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// First script attempt by esd/Wokstation;

//

// Launches an artillery strike at the location of object "esd_l1" when called.;

// Does not stop until an outside command sets esd_barrage to =<0;

//

// Alternative quick-reference munition choices;

// Harrier bomb (biggest): "Bo_GBU12_LGB";

// M1 Tank Shell: "Sh_120_SABOT";

// M1 Tank Shell 2: "Sh_120_HE"

// M16 shell: "G_40mm_HE";

esd_bxpos = 0; // Target x-co-ords;

esd_bypos = 0; // Target y-co-ords;

esd_bzpos = 150; // Release altitude;

esd_bheading = 0; // Heading from target center;

esd_oheading = 0; // Target heading;

esd_b_warhead = "Bo_GBU12_LGB"; // Munition type;

esd_bxposb = 0; // Bomb x-co-ord;

esd_byposb = 0; // Bomb y-co-ord;

esd_brange = 75; // Radius of target circle;

esd_brangeb = 0; // Initialise bomb distance-from-target-center;

esd_bdelay = 0.75; // Delay between munition release;

esd_bxpos = (getpos esd_l1 select 0); // get target x-co-ords;

esd_bypos = (getpos esd_l1 select 1); // get target y-co-ords;

esd_oheading = (direction esd_l1); // get heading;

esd_barrage = 1; // Barrage flag;

// Start of barrage loop (continues until flag =< 0);

while {esd_barrage > 0} do {

esd_bheading = random 360; // Generate random heading from target center;

esd_brangeb = ceil(random esd_brange); // Generate random distance from target center;

esd_bxposb = esd_bxpos + ((esd_brangeb) * (sin(esd_bheading))); // Calculate bomb x-co-ords;

esd_byposb = esd_bypos + ((esd_brangeb) * (cos(esd_bheading))); // Calculate bomb y-co-ords;

boom = esd_b_warhead createVehicle ([esd_bxposb, esd_byposb, esd_bzpos]); // Spawn munition;

boom setdir esd_oheading; // Set munition to face the same direction as the target (for simulating a direction of attack);

boom setvelocity [0,0,-2]; // Set the munition to be heading down;

sleep esd_bdelay * (random 2); // Wait for set amount ( +- 100%) before continuing loop);

};

// END;

Share this post


Link to post
Share on other sites

So it's either perfect, it's not worth the hard-disk-space it's taking up or no-one likes me...

Seriously, no-one even got any suggestions for alternative munitions to drop?

*goes off, slightly disheartened*

Share this post


Link to post
Share on other sites

Comon ... 2 days ..

A hint in general:

Have you posted in at OFPEC too?

It is the best place for mission related business. smile_o.gif

Share this post


Link to post
Share on other sites
So it's either perfect, it's not worth the hard-disk-space it's taking up or no-one likes me...

*goes off, slightly disheartened*

It takes time here dood  smile_o.gif

Since the ARMA Editing Forums were placed in the ass of the skunk that was eaten by a now-dead beast that died in somewhere in the middle of Syberia; it seems sharing and frequent visitors to the ArmA Editing forum have dropped off. (Check my sig heh) lol

There's just...something about where they are placed in the forums...I dunno maybe I'm mental lol

Thanks for the script, soon as I'm done a new mod video I'll check out the script! I could use a good arty script biggrin_o.gif  I've been using Geloxo's arty script for the last month. Anyway this can be adapted to actually fire arty rounds from a Howitzer-type weapon in ArmA?  smile_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]Comon ... 2 days ..

A hint in general:

Have you posted in at OFPEC too?

It is the best place for mission related business. smile_o.gif

I've not, I really don't like regging on too many fora, but two days... that's a regular response time round here? Ouch.
Quote[/b] ]Anyway this can be adapted to actually fire arty rounds from a Howitzer-type weapon in ArmA? smile_o.gif

I've no idea! This was, literally, my very first script ever in the world ever ever. All it does is spawn bombs randomly accross a given circular range at 150m up and stop doing it when you turn the flag off.

Something I've noticed - all of my variables are global - not a good thing. Going to have to amend that.

Share this post


Link to post
Share on other sites

I actually really needed something like this for a mission I am currently working on. Thanks man!

smile_o.gif

Share this post


Link to post
Share on other sites

Sorry if this is a dumb question. I'm fairly new to scripting.

But when I use your script in my mission, it gives me the following error:

' |#|sleep esd_bdelay * (random 2); // Wait f...'

Error Generic error in expression

target...'

And it drops 1 bomb and then stops.

Any ideas? I really need this script to work correctly.

Share this post


Link to post
Share on other sites

Odd... I just executed my copy a moment ago and it worked fine...

And after typing that ^^ I copied the code from this page into a new .sqf and executed it without problems...

Anyone else get this error?

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  

×