Author
Topic: ROMM_IA (ACCEPTED) (Read 6514 times)

This new version of Rommels fMorale/Suppressive Fire Reactive Ai, or the new name: ROMM_IA (Rommel Improved AI). Despite the name changes, has had great improvement. With increased AI reactions, effective suppressive fire, designed for multiplayer and a huge increase in their apparent IQ. Its initial aim was just to make AI's drop to the deck, but over the last few weeks my scripting knowledge has increased and so has this script. It has reached what i wanted to become, and I will only be working on bugs if any are found.NO GLOBAL VARIABLES + SQF Optimized.

Preview Mission Included which as Surdus' Priest's nearExp resource included (love it.),otherwise feel free to edit, keep base credits if possible please, else its open source and go insane.

HowTo: Implement

A simple init line execution is suffice to include this into your missions. nul = [group this] execVM "ROMM_IA.sqf";

_Events_Unit_S =[["[_group] call compile preProcessFile "ROMM_IA.sqf""],[],[],[],[],[]];This will launch the script afterBuildUp in the Dynamic Ai Creator (v2), this area can be found in DAC config folder (config_events.sqf)

I've tested it with ArmA version 1.08 upwards. I highly doubt it to be a compatibility error with mods... however, were you running any, how does it go with standard ArmA if so... when did it crash (if thats what you mean via "hang up").

This is an impressive script. I love a few guys laying down covering fire, while other guys ordered to cover. I also learned a new trick from you about having a gamelogic perform the UseWeapon action (without this trick, the units would perform the gear animation...).

Your use of targeting with UseWeapon command appears to eliminate the need for invisible target addons. That is very cool.

Here's a few issues I'd like to report to you.

1. After all the opfor is dead, soldiers sometimes decide to continue suppressing in directions nowhere near the dead enemy. Like 90 or 150 degrees different direction. I think this occurs if the foe was killed while moving. When targeting, the suppressor is pointing his weapon at the AI's best guess of where the target unit is (based on knowsabout). If the target was moving, knowsabout logic makes the suppressor guess a position based on last known speed and heading of the unit. To illustrate this, I placed a line of empty vehicles (with some gaps between) as cover in front of the opfor. I then gave them waypoints to move from one end of the line to the other, then cycle. The shooter tracked them pretty well until they were dead, but then they started shooting way off mark.

2. UseWeapon on snipers will fire a sniper rifle bullet from the pistol (ARMA bug I guess). This breaks immersion when player sees it. I tried adding some code that if typeOf unit was sniper, then remove the pistol, and add it back after done suppressing. This worked better, but sometimes the sniper would go into pistol animation (with no pistol), and rifle would shoot from shoulder, which is even worse. So that's no good. So I opted for not allowing sniper class units to suppress. That would eliminate this silly ARMA bug.

Again, thanks for the great script.

Logged

El Cojon: "Do you like to Tango?"You: "Only in Bagango."Download Last Tango in Bagango and discover how El Cojon earned his name...

Thanks for the reports, I've noticed myself the random shooting, however it seems that even though theres a alive check, a knowsabout and an ammo check, they keep shooting regardless. I'll continue looking into it.

The sniper bug sounds interesting, I'll make sure to dis-allow them to suppress. (When do snipers supress anyway aye?)

a) AT soldiers will fire bullets out of their rocket tubes.b) Grenadiers often point their weapon at a severe up angle (like they were going to shoot a grenade), and then UseWeapon fires a bullet at that funny angle. Looks dumb.

Also, I may have solved the random shooting problem, and the AT soldier problem. Attached is a sample mission I was tinkering with (based from your sample mission). In it are 3 IA scripts:

- ROMMIA.sqf - your original script, unchanged- ROMMIA3.sqf - modified to cure random shooting using Mando Angles - ROMMIA2.sqf - modified to cure random shooting using Mando Angles plus a new game logic that shooters target as a proxy for the foe. This version also has code in it for excluding snipers, and removing/restoring all rockets from AT soldiers (which cures them of shooting bullets from their rocket tubes).

I tested the 3 different versions by modifying the init lines of the 3 west groups to call whichever script I wanted to test. In order to trigger the suppression scripts, you need to run to one of the cover objects and fire your MG at each of the 3 groups. Then hide. Then switch to the West officers to observe how the suppressors are shooting.

In the modified scripts I put in comments to clearly bracket the changes I made to make it easy for you to identify the new code. If you decide to use any of this code, feel free to rip out my comments.

I used Mando Angles to prevent the shooter from shooting unless he is pointing at original target +/- 30 degrees. So when he is tracking a phantom target too far away from original target, he will not shoot.

In the ROMMIA2 version, I also added a gamelogic for the shooter to target, rather than target the foe unit himself. I discovered that as time elapses, the knowsabout is less fresh, and the shooter will be more likely to target away from the foe location (especially if the foe was moving). The game logic is setposed to the foe's location, and it is deleted and recreated inside the main suppress loop. By recreating it, the knowsabout is fresh again, and the shooter re-targets close to the foe position.

I don't know if there is any performance consideration with deleting and recreating a gamelogic with every loop iteration...but it has worked fine in these limited tests.

Anyway, I had fun doing this, and I hope you find it useful. I know I plan to use this on the sequel to my mission Last Tango in Bagango.

Adios,

Johnnyboy.

Edit1: The same type of fix used for AT soldiers, also works for grenadiers, to prevent them from shooting up in the air. You simply remove and save their grenades at the top of the suppress function:

for "_y" from 1 to _grenCount do {_x addmagazine _grenMag};Edit2: In a copy of your script where I only use the suppress code, I had a problem where once suppressing units "needed ammo", they would go off course to get ammo, but the UseWeapon was still making them fire, so they fired in the wrong direction. So I placed some ammo boxes near the 3 suppressing teams into your demo mission, and the modified demo mission I made, and I removed all but 1 magazine from some of the suppressors. These missions passed the test (both your original, and the modified one). When they went for ammo, they did not fire in the wrong direction. So that's good! In my smaller test suppress version that I copied from your code I must be missing something that allowed the problem to occur...

If you wanted to automate the entire system without having to enter code into each groups init field in the mission editor, you could do this by having server side create a trigger, list all the units in the trigger and from that filter an array of groups