Jump to content
-D:W- CryHavok

Scripting the Ai Grads to fire arty

Recommended Posts

Hi, i am a bit of a noob at mission editing, and i was wondering if anyone can help or point me in the right direction!

I am making a mission with objectives to destroy a few opfor grad arty units, is there any way i can script the Ai to fire the Grads rockets around 1 round per minute (or untill out of ammo) continually at a location? it does not matter of the location just as long the grad fires up to give the impression of the arty firing.

I have used the Arty and Socom modules and can call arty in myself, but when it come to scripting the Ai i don't have a clue how to do this.

Thanks in advance for your help!

Share this post


Link to post
Share on other sites

i came to think of it... is GRAD's "firing" a "muzzle" effect by change?

Haven't tried it,but if someone is reading this, you could check it because im too busy xD.

Also there was topic of making ZU AA gun firing on the sky,that could work also

Share this post


Link to post
Share on other sites

For simplicity I just put an MLRS named art1 a civilian car named car1 and 2 switches. Switch 1 Radio Alpha - art1 doTarget car1. Switch 2 - art1 fire "MLRS". It worked perfectly. Replace "MLRS" with "GRAD" for the russian mobile artillery. I am sure you will want to put this into a script and all, and prolly want to have the arty angle set to something so it is pointing up, but that is another problem. If I work all this out myself I will post the script here.

Share this post


Link to post
Share on other sites

I just need AI unit to aim at target (that it does) and fire some d**n rockets, but can't make AI fire them =/

Share this post


Link to post
Share on other sites

Here's a small example mission that has a battery consisting of three BM-21 vehicles: test_grad_rocket_arty.zip.

Each BM-21 has 40 rockets and the battery will fire all 120 rockets with a five second interval between rockets.

The battery is scripted to fire at the target marker just east of Chernogorsk. It does this via the Artillery Module function BIS_ARTY_F_ExecuteTemplateMission in the trigger placed where the battery is. (One can call this function elsewhere, the trigger is just one way of doing it)

[rocket_arty, getMarkerPos "target", MyHETemplate] call BIS_ARTY_F_ExecuteTemplateMission

  • "rocket_arty" is the name given to the blue Artillery Module unit placed via the F7 - Modules in the editor.
  • The target position is set to the location of the marker named "target".
  • The fire mission details are held in the global variable MyHETemplate

The variable MyHETemplate is set as follows:

MyHETemplate = ["IMMEDIATE", "HE", 5, 120];

That means "fire 120 HE rockets with a 5 second interval".

You can "mapclick" yourself somewhere near the target area to see the impacts.

Feel free to dig into the mission and use it. It should be really obvious what to change to have it fire a rocket every minute instead of every 5 seconds. :)

Also, do read this page as a reference and introduction to the Artillery Module in ArmA 2: Artillery Module

Edited by Killswitch
spelling error corrections

Share this post


Link to post
Share on other sites

wow... thanks killswitch! much appreciated :)

edit: I have added this to my mission and its works great! You can find it on our Deviant Wing Server if you want to have a look

Edited by |D:W| CryHavok

Share this post


Link to post
Share on other sites

But, it is possible to screip that the AI detect your troops and send a mortar barrage against them? I mean instead preconfiguring "targets", but that an actual AI spotter directs AI arty vs actual enemies.

I need this for a coop mission I am working in.

Share this post


Link to post
Share on other sites

Guys, I still don't understand one thing: WHAT must I use to make an arty template? Should I put the text in a trigger or something?

Share this post


Link to post
Share on other sites
But, it is possible to screip that the AI detect your troops and send a mortar barrage against them? I mean instead preconfiguring "targets", but that an actual AI spotter directs AI arty vs actual enemies.

I need this for a coop mission I am working in.

Very possible to do that. I used a FSM that directs a mortar battery to open up on forces detected with a threat level above a given threshold. Calls in the fire missions via the ARTY module ( not using SOM for that ).

You could do the same with ordinary scripts. The use of FSM just avoids some loops and sleeps.

The effect is very entertaining and quite nasty. Players learn very quickly to keep moving and also to disable the communications relay used by OPFOR to call in those mortar strikes.

Share this post


Link to post
Share on other sites

hey all,

ive been trying to see how this works in my mission but when i Download this mission and load it up the Trucks do not fire at all. Someone help :P

Share this post


Link to post
Share on other sites
Very possible to do that. I used a FSM that directs a mortar battery to open up on forces detected with a threat level above a given threshold. Calls in the fire missions via the ARTY module ( not using SOM for that ).

You could do the same with ordinary scripts. The use of FSM just avoids some loops and sleeps.

The effect is very entertaining and quite nasty. Players learn very quickly to keep moving and also to disable the communications relay used by OPFOR to call in those mortar strikes.

Well don't be shy, share the code! I for one would like to see how something like that is done!:)

Share this post


Link to post
Share on other sites

Awaiting response from Evil_Echo, you could check out Domino. De-pbo and check out bat\AiArty.fsm. It only handles the decision making process. The actual generating process is done in bat\fire_missions.sqf, but doesn't use the vanilla system at all. It handles illumination, coordinated missions, adjustment fire, he, smoke, apicm, and will choose mortars over artillery if appropriate.

Not perfect. Decision making regarding artillery was a tiny bit more complex than I first anticipated :p Probably not suited for copy&paste into your own missions, but should be useful how to use fsms as a visual flowchart of how things run. I used to do all this in sqf, but the script just became too messy to keep track of.

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

×