Jump to content
Sign in to follow this  
KrisSerbia

Artillery fire at area

Recommended Posts

How can I make artillery fire at area size 250x250 and at every 10 minutes it fires 5 artillery shells(2 minutes 1 artillery shell)?:confused:Artillery shells to be 60 millimeters.

Thanks:)

Share this post


Link to post
Share on other sites

Well, you can use something like this:

_pos = position Center;
_pX = _pos select 0;
_pY = _pos Select 1;

while {not (isNull Center)} do
{
for "_i" from 1 to 5 do
	{
	sleep 120;
	_dX = (random 250) - 125;
	_dY = (random 250) - 125;

	_pX = _pX + _dX;
	_py = _pY + _dY;
	_bum = "ARTY_Sh_81_HE" createVehicle [_pX,_pY,-5]
	}
}

Where "Center" is the name of any placed in editor object.

I do not know, if there is any available 60mm shell, above is used vanilla ARTY 81mm. Notice "-5" value - shell will be spawned 5 meters below ground level. This will noticeable reduce explosion damage range to be more like 60mm (you can experiment with this value to adjust strenght of explosion, 0 will be maximum here).

I think, that this PMC arty is more sophisticated, and spawns shells randomly, but never to close to player's group. And looks, like center in that mission is player position. Not sure though. Anyway such thing is possible as well if needed.

Share this post


Link to post
Share on other sites

I think it's better in this way :)

_pos = position Center;
_pX = _pos select 0;
_pY = _pos Select 1;

while {not (isNull Center)} do
{
   for "_i" from 1 to 5 do
   {
       private ["_dX","_dY","_tX","_tY"];
       _dX = (random 250) - (random 250);
       _dY = (random 250) - (random 250);

       _tX = _pX + _dX;
       _tY = _pY + _dY;
       _bum = "ARTY_Sh_81_HE" createVehicle [_tX, _tY, 10];
       sleep 120;
   };
   sleep 600;
};

Share this post


Link to post
Share on other sites

Thanks,but where I need to put PHP code?Sorry,I'm new.

Edit:Find how.

Edited by KrisSerbia
Find how

Share this post


Link to post
Share on other sites

Create a sqf file called "arty.sqf", copy the code inside the file and save it inside the folder mission. Then create another sqf file called "init.sqf" and put it inside your folder mission. Open it ("init.sqf") and write

_arty = [] execVM "arty.sqf";

Save it.

In the editor create an object and call it "center". I suggest u to use an empty H.

Then save the mission and you're good to go :)

Share this post


Link to post
Share on other sites
I think it's better in this way :)

_pos = position Center;
_pX = _pos select 0;
_pY = _pos Select 1;

while {not (isNull Center)} do
{
   for "_i" from 1 to 5 do
   {
       private ["_dX","_dY","_tX","_tY"];
       _dX = (random 250) - (random 250);
       _dY = (random 250) - (random 250);

       _tX = _pX + _dX;
       _tY = _pY + _dY;
       _bum = "ARTY_Sh_81_HE" createVehicle [_tX, _tY, 10];
       sleep 120;
   };
   sleep 600;
};

But this way there will be 10 minutes of shelling by one shell per 2 minutes, then 10 minutes of pasue and again shelling, again pause... Unless this is, what was needed. I understood, that is needed just one shell per 2 minutes, so 5 shells per 10 minutes, endless. In fact simplier will be then:

_pos = position Center;
_pX = _pos select 0;
_pY = _pos Select 1;

while {not (isNull Center)} do
{
sleep 120;
_dX = (random 250) - 125;
_dY = (random 250) - 125;

_pX = _pX + _dX;
_py = _pY + _dY;
_bum = "ARTY_Sh_81_HE" createVehicle [_pX,_pY,-5]
}  

("for to do" was only remain after another version, used by me, where was quick series of shells from time to time);

Also

(random 250) - (random 250)

is not exactly same as

 (random 250) - 125

First method does not provide a uniform random distribution across 250 meter square, because where random number is picked twice and both are added, there is involved some quasi-gaussian distribution, I think. I can be mistaken here. Of course not always this matters, and sometimes we need exactly gaussian-like distribution...

EDIT: if needed also this "whistle" sound of falling shells:

_pos = position Center;
_pX = _pos select 0;
_pY = _pos Select 1;

while {not (isNull Center)} do
{

sleep 120;
_dX = (random 250) - 125;
_dY = (random 250) - 125;

_pX = _pX + _dX;
_py = _pY + _dY;
_bum = "ARTY_Sh_81_HE" createVehicle [_pX,_pY,100];
_bum say3D "whistle";
_bum setVelocity [0,0,-300];
}   

Where "whistle" is name of sound defined in description.ext, but this is more complicated. And not sure, if 100 meters and 300 of velocity is enough.

Edited by Rydygier

Share this post


Link to post
Share on other sites
But this way there will be 10 minutes of shelling by one shell per 2 minutes, then 10 minutes of pasue and again shelling, again pause

mmm maybe i don't understand but this is what he wrote:

every 10 minutes it fires 5 artillery shells(2 minutes 1 artillery shell)

Also

(random 250) - (random 250)

is not exactly same as

 (random 250) - 125

I think it's better instead 'cause with your way you'll have an area of 125x125 or less...With mine you could have an area of 250x250 and it's more random...Just an example:

(random 250) - (random 250)  -> 200 -100 = 100

(random 250) - (random 250)  -> 100 -200 = - 100

(random 250) - (random 250)  -> 250 -0 = 250

Just my 2 cents :)

Share this post


Link to post
Share on other sites
every 10 minutes it fires 5 artillery shells(2 minutes 1 artillery shell)

I think, that in fact this can be understood in both ways, still english isn't my language. :)

I think it's better instead 'cause with your way you'll have an area of 125x125 or less...With mine you could have an area of 250x250 and it's more random...

Can't agree... Max dispersion in my way is 125 in both directions, east-west and north-south, what gives 250X250 square, what was demanded. (random 250) - (random 250) gives results from -250 to 250, means total lenght 500, so square is 500X500. As for more or less randomnes... See the pics (5000 positions picked and marked with both methods, plus blue square 250X250):

1. My way:

rnd2.jpg

2. Yours way:

rnd1.jpg

3. For better illustration of "gaussian effect" generated with such code:

_pos = position tr1;

for "_j" from 1 to 5000 do
{
_px = (position tr1) select 0;
_py = (position tr1) select 1;

_rd1 = (random 50) + (random 50) + (random 50) + (random 50) + (random 50);
_rd2 = (random 50) + (random 50) + (random 50) + (random 50) + (random 50);

_dx = _rd1 - _rd2;

_rd1 = (random 50) + (random 50) + (random 50) + (random 50) + (random 50);
_rd2 = (random 50) + (random 50) + (random 50) + (random 50) + (random 50);

_dy = _rd1 - _rd2;

_px = _px + _dx;
_py = _py + _dy;

_i = "mark" + str (random 1000);
_i = createMarker [_i,[_px,_py]];
_i setMarkerColor "ColorRed";
_i setMarkerShape "ICON";
_i setMarkerSize [0.25,0.25];
_i setMarkerType "DOT";
};


_i = "mark" + str (random 1000);
_i = createMarker [_i,position tr1];
_i setMarkerColor "ColorBlue";
_i setMarkerShape "RECTANGLE";
_i setMarkerSize [125,125];
_i setMarkerBrush "Border";

rnd3.jpg

as you can see in third method maximal dispersion is same, as in second, but due to "G effect" nearly all are inside 250X250 square, as for method 1. Fascinating, isn't? :) And useful too, but there are better methods to achieve true Gaussian distribution.

Edited by Rydygier

Share this post


Link to post
Share on other sites

Great,can you make like in the first mission of PMC camping falling shells(don't know is they mortar shells or artillery)form the sky?Size of area is Axis a:200 Axis b:100,10 seconds 1 shell and total 500000 shells(if is possible).:D I'm not so good in scripting.

Thanks!:)

Share this post


Link to post
Share on other sites

Axis a is always E-W and b N-S? Or you prefer, that axis are relative to the player's unit direction (left hand - rigth hand front - back)? Is possible even unlimited number of shells. :) With sound of falling shell? I can search web for some sample, but it can be somehow licensed...

Share this post


Link to post
Share on other sites
I can search web for some sample, but it can be somehow licensed...

Someone posted very recently about adding whistle to falling shells - IIRC it uses some BIS sound. I'll try to re-locate it & post back.

By the way, approve your explanation of Gaussian - avoiding mention of factors like 1/e^2 probably a good idea :)

Share this post


Link to post
Share on other sites

Here is the size of area what i want.

GTgIq.gif

Yes,I want unlimited shells and yes,with sound of falling shells.:D

Thanks!:)

Share this post


Link to post
Share on other sites

Thanks, Orcinus.

So, as I understand, that this area is same way oriented (E-W, N-S) regardless of current player (area center unit) direction, and is moving with player (is stick to player), like in first PMC mission, correct?

Share this post


Link to post
Share on other sites

Great. Thanks again, found these PMC files. The config explorer? Is this some tool?

Share this post


Link to post
Share on other sites

Hmm, didn't I give you the link to that already? Ah, actually it's "config viewer" from Kylania - I did give you the link to that when I posted the link to the cargo capacity PDF. Not sure if it will look for sounds, though.

There's an Editor option you could try - dePBO a mission with artillery whistles & use CTRL+G in the Editor to explore the game configs (though I've never tried it for sounds).

Share this post


Link to post
Share on other sites

Probably you gave me, and I just forgot cause all this intense scripting lately. Must look for it on my HDD. :)

Anyway...

@KrisSerbia

Prepared configurable script packed into mini demo:

ArtySim

To use in own mission, just put into mission folder all files from demo, obviously except for mission.sqm.

To launch all this, open unit's (object's) whose postion should be a center of a shelling area, window in editor and paste in init field same code, as you can see in player's init field in demo:

nul = [this,200,100,85,0,true,true,9,2,"ARTY_Sh_81_HE"] execVM "ArtySim.sqf"

Now, if you want to change something, here is each parameter explanation:

1. Unit (object), that will be a center point of set shelling area;

2. horizontal dimension of rectangle area (area lenght);

3. as above, vertical (area width);

4. Minimal distance of impact from center to avoid damage (or not :) );

5. Initial angle of area;

6. If area should follow center object (true) or stay, where was initially set (false);

7. If area should change its angle according to current central object direction (true/false);

8. Minimal time interval between shells;

9. Range of additional randomized interval - so here minimum gap will be 9 seconds, maximum 11 (9 + random 2);

10. Classname of used ammunition (can be classname of any object, so you can prepare shelling even with cows or tanks :) ),

I hope, that this is bug-free - tested and works...

PS. As you requested 200X100 area, so from center to lower or upper edge is only 50 meters, and minimal safe distance is about 80 meters, so in this configuration shells will fall always somewhere on the sides, never exactly on the front or rear, if "follow" and "change angle" are true.

Edited by Rydygier

Share this post


Link to post
Share on other sites

Thanks!Thank you!Just one question.Do I need to put only in one unit nul = [this,200,100,85,0,true,true,9,2,"ARTY_Sh_81_HE"] execVM "ArtySim.sqf to script work in mp?

Edit:Thanks anyway.I making camping with Italian operators.In first mission Italian plane has shut down in Lingor and the shells are falling from the sky.Thank you for the script.When I finish first mission,I will send it to you.;)Thanks!:)

Edited by KrisSerbia

Share this post


Link to post
Share on other sites

Sadly haven't much knowledge about MP but anyway if you put this in one unit, this unit will be center, if for more - each of them will be surrounded by shelling same way. So yes, one unit only. I hope, that there will be no problems with "locality" in MP. Also here is enhanced version:

ArtySimB

Two new parameters:

nul = [this,200,100,85,0,true,true,9,2,"ARTY_Sh_81_HE",1,0] execVM "ArtySim.sqf"

11. Number of shells for each shelling (set to 1 to keep shelling in old manner);

12. Range of randomized interval in each salvo (set to 0 if you set 1 shell per salvo);

This give you an option, that shelling will be not so uniform, but rather there will be dropped each time a quick salvos of shells (barrage of the whole battery will look like this).

Share this post


Link to post
Share on other sites
Probably you gave me, and I just forgot cause all this intense scripting lately. Must look for it on my HDD. :)

Hi mate. I had a chance to look through my own HD - try this neat mission-based tool, it will browse sound CGF tree (based on HeliJunkie's nice Cfg explorer, which was the one I was thinking of originally).

Apologies for delay - I must reorganise my Arma download library, getting really messy & taking ages to find anything I can't remember by name....

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  

×