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)?Artillery shells to be 60 millimeters.
Thanks![]()
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)?Artillery shells to be 60 millimeters.
Thanks![]()
Editor is my life!
Try to search in the first ION (PMC) mission. There's something similiar
Well, you can use something like this:
Where "Center" is the name of any placed in editor object.PHP Code:_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]
}
}
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.
Spoiler:
I think it's better in this way
Code:_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; };
Thanks,but where I need to put PHP code?Sorry,I'm new.
Edit:Find how.
Last edited by KrisSerbia; Jun 15 2012 at 14:36. Reason: Find how
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
Save it.Code:_arty = [] execVM "arty.sqf";
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![]()
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:
("for to do" was only remain after another version, used by me, where was quick series of shells from time to time);PHP Code:_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]
}
Also
is not exactly same asPHP Code:(random 250) - (random 250)
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...PHP Code:(random 250) - 125
EDIT: if needed also this "whistle" sound of falling shells:
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.PHP Code:_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];
}
Last edited by Rydygier; Jun 15 2012 at 16:32.
mmm maybe i don't understand but this is what he wrote:
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:Code:every 10 minutes it fires 5 artillery shells(2 minutes 1 artillery shell)
PHP Code:(random 250) - (random 250) -> 200 -100 = 100
PHP Code:(random 250) - (random 250) -> 100 -200 = - 100
Just my 2 centsPHP Code:(random 250) - (random 250) -> 250 -0 = 250
![]()