Well, at this pace it looks like we will get five variants of a falafel food truck before we get the CSAT AI to use its indirect fire support without some sort of scripting ...
I'm sure there are many scripts out there to have the enemy AI to shoot a mortar shell at you. But I always prefer something very simple and maintenance free.
So I found this page, where the process of creating such a thing is just a handful of clicks and just two lines of code that is added straight into the editor's entities.
AI Artillery
|
In the editor, create a mortar, name it "mortar1" and if you want it to have unlimited ammo, place the line of code seen in the initialization field. |
|
Then create a trigger entity, big enough to cover the area of operations (a circle of 5,000 meters in this case). The trigger activates when the OPFOR (in this case my troops are OPFOR) is detected by BLUFOR (in this case enemy rebels). Then add the code shown above in the "ON ACT." field: that makes "mortar1" to fire at the position where the OPFOR (that is us in this case) was detected. |
I added a timer of a minimum of 2 minutes to activate the triggered mortar fire (see "timer" fields in the above screenshot). This is to simulate the time taken to transmit the coordinates by the BLUFOR forces to their mortar. There is no need for "mortar1" to have a LOS on the target at which is firing with this trigger.
|
I tested the setup in a self-edited mission where a squad of AAF infantry has to defend itself against a platoon of enemy rebels (FIA faction, computer controlled). The defensive position is placed in the ruins of a farm. |
|
We spot the enemy platoon when it is at a range of around 1 kilometer or so. We try to hold our fire as much as possible. |
|
The enemy is advancing towards our position from the far background. The enemy has one mortar tube ("mortar1") located on the other side of those hills. |
|
The enemy is still not aware of our location and advances without too much care. |
|
We open up on them at a moderate range. One of their squads is overwhelmed by our fire. But bullets still fly over us, a clear indication that we have not achieved total fire superiority on all the enemy squads. One of the enemy AI squads threw smoke, which is something I heard about before but it was very cool to see for the first time. |
|
The other enemy squads are finding their way towards our position. Our ranges of engagement shorten dramatically. |
|
Then the enemy mortar fire starts to fall on us. We are at the ruins in the mid background. Note the mortar shells' dispersion. |
In a panic, I check my casualties and I have two men down. I then make the mistake of ordering everybody out, thinking that the mortar fire was about to wipe us out. My men move with me, but are taking down not by mortar but by rifle fire from the closing enemy. The mortar shells continue to fall as I watch how my virtual self is killed by machine gun fire.
I kinda liked being killed today. :)
Cheers,
14 comments:
command Artillery Fire only works in Arma 3, which is fine. But trying this out and looking for alternatives, I found this and it works really well in Arma 2.
I tried this out and it works well. Having a lot of fun getting pinned down so to speak :)
Thanks badanov, I will be using that in ArmA 2.
Phil, glad to hear that. All credit goes to the author of the material linked from my post.
Cheers,
Just curious. Does the mortar fire stop if the mortar position is overrun? It'd be amazing to get a simple mortar position that can be neutralized. Most of the scripts spawn mortar shells above the target and track the player like the unstoppable and unshakable hand of a vengeful God until all potential targets are killed regardless of how many mortar crews you dispatch with extreme prejudice.
Anthony: In Arma 2 if the trigger is set to repeat, the mortar unit fires until either the target that tripped the switch is dead or the mortar unit runs out of ammunition.
You can set a trigger to delete the repeating trigger in case your unit wants to overrun the position.
In ArmA 2 you could set up actual artillery units (mortar, howitzer or MLRS) using the artillery module and this bit of code in the init field of the trigger:
[M1, getmarkerpos ""M1FM1"", [""IMMEDIATE"", ""HE"", 0, 12]] call BIS_ARTY_F_ExecuteTemplateMission
You would need an empty marker named M1FM1 (or whatever you would want to call it).
The artillery fire was totally dependent on location and the status of the troops manning it: locate it under a tree or next to a building and the rounds would explode on contact, and if you took out a mortar gunner from afar with a sniper rifle the mortar would stop firing.
No external scripts would need to be present or called.
Cant make it work. using getposatl keeps telling me type array, expected object. please help.
@Ashmit Kundu:
you have to copy the text exactly. this is what it actually says:
on act
mortar1 commandArtilleryFire [getposatl (thislist select 0), "8Rnd_82mm_Mo_shells", 6];
Thank you very much!
I Luv youuu : )
copied it exactly. says i am missing a ]. Help please?
Hi,
Did you try adding a ] ?
I will try this again when I get home.
Sorry for the inconvenience,
Cheers,
Is there a way to keep the mortars back and still have them fire? They seem unable to switch to medium/long rage mode on their own, so if I want them to fire I have to pretty much put them right on top of their target...
Hi Sean,
Sorry to hear that. Let me try and get back to you.
Thanks,
JC
Hi Sean,
I tested it and it works only on short distances. Sorry about that: I don't know how to fix it. Besides this, it is throwing an error message.
Oh, man.
Cheers,
Post a Comment