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.
|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.|
|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.|
|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.|
I kinda liked being killed today. :)