Jump to content
Sign in to follow this  
CaptainBravo

enemy artillery ?

Recommended Posts

Hey everyone,

I am searching for a script where enemy uses artillery against you?

Does such script exist?

Thanks for your help in advance.

Share this post


Link to post
Share on other sites

hi captain

i have been working on something similar and had to pull several strings together from various threads but it works well now. to save you the trouble...

this is an example with mortars and assuming you are BLUFOR:

1. place a couple of OPFOR mortars near to each other on the map (RU podnos 2B14) they will be automatically grouped together. give names mortar1 and mortar2 although this is never actually referenced as far as i can tell, its probably not bad practice.

2. place an artillery module on the map and SYNCH it to the leader of the two mortars. give the artillery module name RU_mortar

3. in the mission folder create a file called mortar.sqf and paste the code below into it and save.

#define __debug true

_mortarTgtPos = _this select 0;

if (__debug) then { player sideChat "Executing mortar.sqf" };

if ([RU_mortar, _mortarTgtPos, fireMission select 1] call BIS_ARTY_F_PosInRange) then
{
[RU_mortar, _mortarTgtPos, fireMission] spawn BIS_ARTY_F_ExecuteTemplateMission;
hint "mortars: Firing.";
_mrk = createMarker ["MortarTarget", _mortarTgtPos];
_mrk setMarkerColor "ColorBlack";
_mrk setMarkerShape "ICON";
_mrk setMarkerType "mil_objective";

waitUntil {RU_mortar getVariable "ARTY_ONMISSION"};
if (__debug) then { player sideChat "mortars are on a mission" };
if (__debug) then { player sideChat format["ammo used: %1", RU_mortar getVariable "ARTY_AMMO"] };
waitUntil {RU_mortar getVariable "ARTY_COMPLETE"};
if (__debug) then { player sideChat "mortars have finished fire mission" };
waitUntil {RU_mortar getVariable "ARTY_SPLASH"};
if (__debug) then { player sideChat "mortars about to splash!" };

sleep 10;

deleteMarker _mrk;
}
else
{
hint "mortars: Target out of range";
};

if (__debug) then { player sideChat "Exiting mortar.sqf" };

many, many thanks to the author! :) sorry i cant remember which of many threads i lifted it from.

4. create a trigger with dimensions large enough to cover the area where artillery can be targeted. on utes i covered the whole island (1250x950m)

Activation BLUFOR, detected by OPFOR, repeatedly

in the On Act. box paste this:

hint "detected";firemission = ["IMMEDIATE","HE",0,8]; nul=[getPosASL (thisList select 0)] execVM "mortar.sqf";

the position of the first unit of the BLUFOR group detected within the trigger area by OPFOR will be passed to the mortar script. the script will also reference the firemission parameters - in this case we specify 8 rounds of HE. if you want less or more rounds just change the 8.

to add a delay between detection of BLUFOR and firing to represent communication time, put some values in timeout min mid and max

you might also want to give the mortars extra ammo with

this addmagazine "2b14_82mm";

multiple times in their init boxes

death from above!

the beauty for me of doing it this way with actual units on the battlefield is, you can see/hear the mortars firing which is cool and as BLUFOR you get to take them out. ;)

Share this post


Link to post
Share on other sites

I tried that very script out the other day and only one of the grouped mortars fired. I also couldn't get dispersion to work correctly. All landed right on target instead of all over the place as I'd wanted. *shrug*

Share this post


Link to post
Share on other sites

yeah i found it a little too "punishing" too with no dispersion, next up im going to try updating the script by adding a line with BIS_ARTY_F_SetDispersion but didnt get round to it yet. need to get my head round milliradians first. :eek:

will post up the amended version if i get it working

strange about only seeing one mortar fire - i see them alternating which is pretty nice. here is an example mission, just wait until the marines land in the north - both mortars will turn and start firing...

http://thelaw.dns-systems.net/takeUtes%20II.zip

it's the only place i have to put it - if it needs a password sorry, i will have to ask me mate later to allow anonymous logins

---------- Post added at 09:49 AM ---------- Previous post was at 08:38 AM ----------

http is public apparently so no problem there

something up with the link i posted though

just go to http://thelaw.dns-systems.net/ and you can see the zip to d/l

regards, Sam

Share this post


Link to post
Share on other sites

Thanks Ashram, I will try later tonight.

Would fire on last known position of enemy or continue following him even though he is not within line of sight?

Thanks.

Share this post


Link to post
Share on other sites

glad to help

re: Would fire on last known position of enemy or continue following him even though he is not within line of sight?

i think only the "initial spotted position" gets passed to the script and is used for every round in the firemission so in effect it will not track the units if they subsequently move.

thats how it works IRL anyway i suppose - these mortars are quite deadly enough without homing capability

to confirm - put yourself as player in one of the marine landing parties in that mission and delete the other rhibs/squads. you will find that things get rather hairy near the beach once you are spotted. it should be possible to leg-it out of the danger zone and watch the rounds land where you were when the "detected" hint appeared. your comrades may not be so lucky though :butbut:

Share this post


Link to post
Share on other sites

Thanks. I shall try it tonight and it sounds like what I need.

I remembr group link script had artillery by enemy AI that was pretty good but I am not sure if it has been ported to arma2?

Share this post


Link to post
Share on other sites

Ashram,

Great script! Only question anyway to get it fire 10 times every 30 seconds then stop (unless it gets detroyed)?

Thanks.

Share this post


Link to post
Share on other sites

I have a forward observer script, that you can attach to an actual unit that will act as a FO till it is killed. It searches for targets within a certain radius and then calls fire on the one with the maximum number of units within lethal range of the shells.

Its pretty basic at the moment as it only targets soldiers and no vehicles, but it works pretty well.

I'll post up code later when I get on my PC.

Share this post


Link to post
Share on other sites

yeah good innit :D all credit to Inkompetent

http://forums.bistudio.com/showthread.php?t=85654&highlight=_mortarTgtPos+_this+select

to get it fire 10 times every 30 seconds then stop

bit beyond me that...but in theory i suppose, create a global variable as a counter initial value 0, increment it every time the script runs, in the condition of the mortar trigger check the counter is < 10 and if not it won't activate fire mission. for the delay put 30 in the min mid and max boxes of the trigger?

got dispersion working easily... add the bold line to mortar.sqf

if ([iNS_mortar, _mortarTgtPos, fireMission select 1] call BIS_ARTY_F_PosInRange) then
{	
[b][iNS_mortar, 200] call BIS_ARTY_F_SetDispersion;[/b]
[iNS_mortar, _mortarTgtPos, fireMission] spawn BIS_ARTY_F_ExecuteTemplateMission;
.
.
.

RU_mortar would apply to the version in my first post of course.

Edited by Ashram 1-1
poor version control!

Share this post


Link to post
Share on other sites

@Ashram, could you please post mission example with dispersion?

Also will the artillery continue firing after first round as long as enemy troops are still within trrigor? Thanks.

@NouberNou: the idea of FO sounds very interesting. I'd love to see (and learn) from your mission example. Thanks.

Thanks for all the input and help.

Share this post


Link to post
Share on other sites

sure no problem - same place http://thelaw.dns-systems.net

takeUtes%20II-dispersion.zip

screenshot in there too.

i think all rounds will fire regardless of whether units are still in the trigger or not. once it's triggered, it's triggered

looking forward to seeing that FO script too, no pun intended

arrrghh, installed a quad core last night - too tired to play or edit though - when i just fired up arma2 just now to check my mission works before posting i noticed a horrible "lag" effect on some men running in the distance. gliding mysteriously over the landscape as though massive chunks of the animation are missing :butbut:

not the kind of improvement i was hoping for :rolleyes:

btw does anyone know how to get marines to reliably disembark from a boat? lol i expect they cover that in basic training - but they seem to like to go for a swim... maybe i should change the date so it's not so hot in Utes ;)

probably should search / start a new thread for that one...

Share this post


Link to post
Share on other sites

Yea I should be able to post up something tmrw. I am getting the lists of units it can target together now, which is sort of a pain in the ass.

Share this post


Link to post
Share on other sites

Sorry to ask an idiotic question - but I'm having trouble converting this script to work with the Guerrillas.

My approach so far could be summed up as replacing all of the instances of RU_mortar with GUE_mortar.

I've replaced the units in the sample mission and resynchronised the artillery module which I have also renamed.

Any idea what I'm missing? Durrrh, I forgot to update the trigger.

facepalm.jpg

Edited by Uncle Imshi

Share this post


Link to post
Share on other sites

I want to use the script for activating a D30 artillery, and no way to get it working, always says out of range. I works fine with mortars, but no way to get it working with artillery, anyone had the same problem ?

Even more weird, nice bug, I use UAV to detect the BLUFOR, and when shooting UAV, get a pilot with parachute created...

Share this post


Link to post
Share on other sites
takeUtes%20II-dispersion.zip

screenshot in there too.

Genius! I included this arty thing in my mission, thanks. :D

One thing though, I get some messages when the enemy decides to blow me to atoms...is it possible to make those messages not appear to me?

Share this post


Link to post
Share on other sites

Just a little proof of concept I have been playing with.

I like the idea of the ai artillery being as real as possible within the restrictions of the game. So I like the idea of a FO that can be killed, stopping the eyes of the artillery. I like having real guns, whose rounds take time to get from firing to impact, and can be destroyed which will stop the artillery as well. Meaning they generally have a finite amount of munitions as well. With real guns it allows multiple FO's to call them and they can only fire at their maximum rate.

Problem is when rounds take approx one minute to travel to impact a lot of things can change. Mainly the target you are aiming at will not be in the say place.

So I started with a small script that has a basic prediction calculation to set the impact hopefully where the target will be. Then I realised there are many ways that a mission design might want to implement an ai artillery component.

For me at the end of the day I like the implementation to be resonably simple. So I wanted to use the existing artillery module. That way most of the artillery style objects can almost be interchanged with little or no messing about.

So I thought how about a modular system, with a core component that can have extra stuff built around it. It also allows for improving the system and making it upgradable too.

http://www.armaholic.com/page.php?id=8421

It has the core script, plus three applications of implementing the core script. These can either be used as is, or as a base to customise your own system.

This can be as simple as adding to a trigger, or an elaborate custom script.

Most of the time all you need is some arty objects sync an artillery module to them. Create an FO style unit and place one of the scripts, or your own, with the appropriate parameters. Just make sure they are in range, and they can be called to fire the custom munitions if you have added the appropriate magazines.

Now the features are fairly simple, the prediction just takes a snap shot of the speed and direction of the unit. so ai being ai can make some rounds land in odd spots. It has a limiter to stop fast units causing rounds to land miles away. Though the system could have this added to it with it being modular. It has a simple friendly check to make sure there are no friendlies with 50m of the impact area at the time of firing. Though the dispersion parameter can make this still to close.

Anyway, it should be ok on a dedicated, I did a small amount of testing on ours.

Share this post


Link to post
Share on other sites

This script works great and will be nice to use, but how do I get the mortar teams to fire 8 rounds every 60 seconds? Currently, the script only has them fire 8 rounds then they are done for good. I want them to continue firing until there are no more detected BLUFOR or until they are dead, in increments of 60 or so seconds. Is this possible?

Share this post


Link to post
Share on other sites
;1495469']This script works great and will be nice to use' date=' but how do I get the mortar teams to fire 8 rounds every 60 seconds? Currently, the script only has them fire 8 rounds then they are done for good. I want them to continue firing until there are no more detected BLUFOR or until they are dead, in increments of 60 or so seconds. Is this possible?[/quote']

Sorry Grimes there are a few different scripts talked about in this thread. So I will answer how I would achieve something like this with mine. Either use the artytrig.sqf, placed in an FO style unit, and a marker to represent the centre of the trigger area. If there isn't enough rounds try adding another FO calling another artillery battery to up the volume of fire.

Another way is to use the core script aifiremission.sqf in a trigger using thislist select 0

as the target parameter.

In the activation area also add

oldtime = time;

In the condition area place

this and oldtime != time

Create a game logic and in it's init line place

oldtime = 0;

Depending on what style of trigger you create, opfor present or opfor detected by blufor etc, this will prosecute those units repeatedly in the area.

Use the timeout values to adjust the frequency.

Share this post


Link to post
Share on other sites

hi,

Fred i tried it also with the D-30 and had the same problem, even creating a mission on larger Chernarus map in case it was a minimum range issue. sorry dont know the solution

Ziiip - basically need to remove the statements with "player sidechat" and "hint" commands from the script - but...

i didnt make the script myself and although i have done quite a bit of programming the structure of the conditional statements with all the curly brackets is completely obscure to me in the arma 2 scripting language.

i dont want to post up an edited version without first checking i havent screwed up the logic of the script and am away from home for a few days - the hints are handy for testing purposes but indeed are not so good for an actual mission, so i would like a "silent" version of the script for my own use too. will give it a go and post again later this week.

regards, Sam

Share this post


Link to post
Share on other sites

Could you elaborate more on the 2nd method with the aifiremission.sqf? I just don't know where to put the thislist.

Edited by Grimes [3rd ID]

Share this post


Link to post
Share on other sites
;1496654']Could you elaborate more on the 2nd method with the aifiremission.sqf? I just don't know where to put the thislist.

null = [thislist select 0' date=Guns1,4] execVM "aifiremission.sqf"

If you place the above in a trigger, thislist select 0, specifies target the first unit that is part of all the units that activated the trigger. Which is the first doesn't matter, for our needs it just means he drew the short straw. Guns1 would be the name of the artillery module you synced with your artillery units.

4 is how many rounds to fire.

Below is the list of the optional arguments. Note friendly is by default opfor. So if you want to fire at opfor you need to change this.

null = [thislist select 0,Guns1,4,"HE",100,20,5,"SoldierWB"] execVM "aifiremission.sqf"

The above would be required if the trigger was for firing on opfor troops. The reason there are so many arguments is we wanted to changed the last option, and have to include any arguments that proceed it.

Battery - which is the name of the artillery module you are calling (Default Art1)

Number of rounds - How many rounds to fire assuming the artillery has the ammunition (Default 1)

Round Type - Select the type of round HE by default. The other types must be added to the artillery objects for them to fire them (Default "HE")

Dispersion - Basically how much spread between rounds (Default 100)

Prediction Calibrator - A way to influence how far ahead in the current direction of the target to rounds land (Default 20)

Skill - A basic way to see how accurate the placement is values from 1 to 10 (Default 5)

Friendly - Checks to ensure their is not a friendly of this type within 50m of the impact location (Default "SoldierEB")

Ok so that goes in the activation field. The oldtime component is just a way of getting the trigger to fire more than once.

Share this post


Link to post
Share on other sites

Thanks for the quick response, works pretty well actually. One thing though... dispersion does not seem to be working, or at least not working well enough. With it set to 100m spread, the mortars still land within a 20m circle. A bit too punishing.

Edited by Grimes [3rd ID]

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  

×