Jump to content
Sign in to follow this  
m4rk3tin6

How to make an artillery firing at a fixed point.

Recommended Posts

Well, I wonder if there is a way to make an artillery firing at some fixed location, with infinite ammo, because I wanted her disparece on site throughout the game, noting that the artillery could be using the "artilhary computer", and also wish there was one area that make the missiles are random in that position.

Thanks.

Share this post


Link to post
Share on other sites
look at virual artillery in wiki.

http://community.bistudio.com/wiki/Artillery_Module#Virtual_Artillery

can fire infinite rounds anywhere. and in a wide spread as you want.

Thanks again Demonized, i'll try.

---------- Post added at 10:33 PM ---------- Previous post was at 10:29 PM ----------

The problem is that know nothing about script, i can only build when I see an example mission, you do not happen to have one there, would it?

Share this post


Link to post
Share on other sites

did you watch the video tutorial in the link?

Pizza is on the table, ill throw something together after i have eaten.

Share this post


Link to post
Share on other sites

Yeah I saw, and got the mission for example, was that I needed more artillery disparece without command of Player or Ai, she simply wanted a pier in the area.

Share this post


Link to post
Share on other sites

EDIT: for some reason (lack of sleep probably) i added dependancy of function module, this is not needed, script below, and how it was done is updated, demo mission is not.

Edit2: i edited setVirtual artillery part as it was using module and not pieces.

well it certainly took awhile to figure out the arty stuff again.

Note that this is not perfect usage, but usable with more info than required along the way.

Infinite artillery barrages on any size area

here is demo mission, open the arty_test.sqf for more info.

http://www.4shared.com/file/8qXI1WDf/arty_testTakistan.html

basically in mission use the radio triggers to start or stop/pause artillery, you can change size of marker to increase dispersion.

scripts used:

init.sqf

// starting artillery.
artillery = false;
_null = ["target_marker",art1] execVM "arty_test.sqf";

this is the script used to call and adjust dispersion and get target area:

arty_test.sqf

/*
artillery example based on marker size.
By Demonized

Place functions module on map. - EDIT : this is not needed.
Place artillery module on map, name it in name field (in this example its art1)
Place a virtual artillery on map and synchronize it to artillery module.
Place more virtual artillerys and group them to first one (above) 3 total is used in this example.
Place a empty marker, name it: target_marker, make it rectangle, any size but keep it same sides, meaning size should be 100 100 or 399 399 as dispersion is based on a square size.

Place this in init.sqf:
// starting artillery.
artillery = false;
_null = ["target_marker",art1] execVM "arty_test.sqf";

Start the whole thing with radio trigger or something similar with this in on act:
artillery = true;
Pause the whole thing again with another trigger or something similar with this in on act:
artillery = false;
*/

_targetMarker = _this select 0;
_batteryLeader = _this select 1;
_size = 200;  		// dispersion used if not using markersize.
_debug = true;  		// display help player sidechats if true, if false, no player sidechats.
_barrageAdjust = 20;	// this is how much area size is deivided n to get amount of shells / barrage, set to lower to get more shells, higher to get less shells.

// is function module active?, if not wait for function module to be activated.
// waituntil {!isnil "bis_fnc_init"};  // EDIT : this is not needed.

// this checks if you have triggered the radio trigger to activate artillery barrages.
waitUntil {artillery};

if (_debug) then {player sidechat "Artillery is starting, it will take a minute until first shells to arrive"};
while {true} do {
// get the size of the marker and use that as dispersion value, firing all over inside marker area.
_sizeM = getMarkerSize _targetMarker;
_size = (((_sizeM select 0)+(_sizeM select 1))/2);
if (_debug) then {player sidechat format["size of area is %1",_size]};

// determine amount of shells based on total area size / _barrageCnt  -  500 big size makes it 25 shells / barrage.
_barrageCnt = _size/_barrageAdjust;

// waituntil artillery is ready to fire again.
waitUntil {([_batteryLeader] call BIS_ARTY_F_Available)};
if (_debug) then {player sidechat "artys are ready"};

// this will define what type of arty it is, in this case its d30 artillery.
_synchObj = synchronizedObjects _batteryLeader;
{
	_grp = (group _x);
	{
		if ((typeOf _x) == "BIS_ARTY_Virtual_Artillery") then {
			// this will define what type of arty it is.
			[_x, "D30"] call BIS_ARTY_F_SetVirtualGun;
		};
	} foreach units _grp;
} foreach _synchObj;

// make the shells spawn in the air if true, if false they can hit mountains if placed badly.
[_batteryLeader, true] call BIS_ARTY_F_SetShellSpawn;

// set the size/dispersion of fire area.
[_batteryLeader, _size] call BIS_ARTY_F_SetDispersion;

// this will do the actual firing, 1 second between each arty unit in group total area size / _barrageCnt pr barrage.
[_batteryLeader, (getMarkerPos _targetMarker), ["IMMEDIATE", "HE", 1, _barrageCnt]] call BIS_ARTY_F_ExecuteTemplateMission;

waitUntil {_batteryLeader getVariable "ARTY_ONMISSION"};
if (_debug) then {player sidechat "The battery is on a mission"};

waitUntil {_batteryLeader getVariable "ARTY_COMPLETE"};
if (_debug) then {player sidechat "Artillery is rounds complete"};

// check if it can continue else wait until it can continue.
if (!artillery) then {
	if (_debug) then {player sidechat "Artillery is barrage is paused"};
	waitUntil {artillery};
};
};

how it was done:

first i placed a function module on map. - EDIT : this is not needed.

then i placed a artillery module on map and named it art1.

then i placed a virtual artillery piece on map and synchronized it to the artillery module.

then i created 2 more virtual artillery pieces and grouped them to the first one, so i now have 3 total "artillerys" in my battery.

Then i created an empty marker and named it target_marker, and clicked on rectangle, and set the size i wanted and placed it on a town.

Note: you can use any size and it will correct itself in script.

You can even move it around during the mission and adjust its size and script will adjust acordingly.

i created a variable in init.sqf

// when false this makes the artillery script stop or not start.

artillery = false;

// this activates the artillery script in start of mission and waits until artillery is set to true.

_null = ["target_marker",art1] execVM "arty_test.sqf";

i then used 2 radio triggers to start or stop artillery barrages.

radio trigger alpha: // this is the one that starts the barrage.

on act: artillery = true;

radio trigger bravo: // this is the one that stops/pauses the barrage.

on act: artillery = false;

Extra notes: you see i used the name of the marker and the name of the artillery module in init.sqf.

you can place multiple batterys, and multiple markers and run multiple scripts if you just change the names in the execute line.

All info related to functions module is not needd.

Example:

Create 2 or more sets of artillery batterys as described above.

use this in init.sqf or a trigger or somewhere.

_null = ["one_marker",art1] execVM "arty_test.sqf";

_null = ["some_other_marker",art2] execVM "arty_test.sqf";

now battery named art1 shoots at one_marker position.

battery named art2 shoots at some_other_marker position.

Both will respond to artillery true/false.

More info on artillery and the different commands used here:

http://community.bistudio.com/wiki/Artillery_Module

Edited by Demonized
updated script

Share this post


Link to post
Share on other sites

It worked perfectly, thanks Demonized.

This will work on a dedicated server?

If I helped increase the number of virtual artillery, will ally the cadence of fire at the site?

How the bombing has to be constant throughout the game?

Thanks so much again.

Share this post


Link to post
Share on other sites

for dedicated server i think only change you need to do is to add this line at the very top of arty_test.sqf:

if (!isServer) exitWith {};

if you dont add that line i think there will be a arty fire mission for every player making it a mess or error.

You can have as many virtual artillery pieces as you want making it even more deadly, also you can run as many battery sets as you want as well either on seperate markers or same marker as well.

Edited by Demonized

Share this post


Link to post
Share on other sites

One more question, is there any way to make a BM-21 Grad shoot up, without a specific target, or with any target, whatever, just doing her shoot to do a good "intro".

U can help-me in this ?

Share this post


Link to post
Share on other sites

Ey Demonized, it's don't work in dedicated :/

any idea ?

Share this post


Link to post
Share on other sites
One more question, is there any way to make a BM-21 Grad shoot up, without a specific target, or with any target, whatever, just doing her shoot to do a good "intro".

U can help-me in this ?

just do as the demo missions in the artillery web page i gave you or change the virtual artillery pieces in my script to BM-21 Grad and group and synch same way.

Ey Demonized, it's don't work in dedicated :/

any idea ?

Did you try:

for dedicated server i think only change you need to do is to add this line at the very top of arty_test.sqf:

if (!isServer) exitWith {}; 

Share this post


Link to post
Share on other sites

im not sure, just copy and replace the script into the script you downloaded.

Btw, i have a new version, more advanced options to be used if desired, and will post it soon.

Share this post


Link to post
Share on other sites

thx, i waiting a new version, n i'll try update the script in my mission.

thx again.

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  

×