OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: johnnyboy on 03 Apr 2007, 22:01:32

Title: Coup De Grace script (DELAYED)
Post by: johnnyboy on 03 Apr 2007, 22:01:32
When passing a dead enemy, AI will turn and shoot the body once or twice to "finish him off".   He will also voice taunt before shooting (i.e. "Adios Mother F******!").  Used sparingly, this is cool for immersion.  I got the idea from one of my favorite shooters Vietcong.  After a firefight in Vietcong, the AI teammates would check the downed enemy, and occasionally pump a few extra rounds into them.

Requires the Invisible Target addon found in MapFacts awesome Map_Misc addon:

http://www.mapfact.net/include.php?path=content/download_eng.php&contentid=584&PHPKITSID=875161ea5d677ba335ca5a8bff22aada

Features:
* Passing AI will shoot dead soldier.
* Voice taunt said before shooting.  (You can toggle this off).

Limitations:
* Script will not activate for Group Leaders, as DoMove commands screw up their waypoints.
* Script will not activate for AT or GL soldiers, because the stupid AI for these soldiers makes them often choose to use their rocket or grenades at point blank range.  So we skip these soldiers.
* Shooter must be 2.5 meters or more away from dead enemy, or he won't fire (an AI issue...too bad, as it would look better if shooter stood very near enemy and shot straight down).

Known Issues:
* Shooters occasionally don't fire.  Eventhough they have stopped, targeted, and said their taunt.  No clue how to fix this.
* Shooters not very accurate.  Not sure if its AI accuracy issue at close range, or invisible target placment issue.  I'm working to improve this.
* If friendly AI walks between shooter and dead enemy, shooter may friendly fire his buddy.
* Script needs performance tuning.  When I put this in a big busy mission, with lots of dead bodies running the script, and lots of groups input as possible shooters, it killed the frame rate.  I'm working on this, and would love to hear any suggestions.
Title: Re: Coup De Grace script
Post by: Mandoble on 19 Sep 2007, 22:44:04
Any way to have it addonless, or at least a similar effect?
Title: Re: Coup De Grace script (TESTING)
Post by: Spooner on 20 Sep 2007, 02:06:57
On the speed issue, some suggestions:

Those two issues seemed to be the things most likely to be a strain, as far as I could see on a scan through the code.

I concur with Mandoble, that this script could be made addon-free. The two key components would be some sort of line-of-sight calculations (to prevent trying to shoot through scenery/friends) and using something like:
Code: [Select]
_shooter lookAt _corpse;
_shooter action ["useWeapon", _shooter, _shooter, 0];

The issue with this is knowing what index the current weapon is in (0 in this example), but I'm sure that something could be worked out, especially since these are AI and more predictable in what weapons they have than players would be. Note that the "fire" keyword can't be used in this case, as it will cause the shooter's weapon to point wildly upwards, for an unguessable reason known only to BIS).
Title: Re: Coup De Grace script (TESTING)
Post by: johnnyboy on 20 Sep 2007, 05:39:51
Spoon and Mando,

I will definitely give the "_shooter action ["useWeapon", _shooter, _shooter, 0]; "  suggestion a try.  I was completely ignorant of this command.  I knew that dofire made the AI shoot in the air, which is why I went with the invisible targets. 

Also, I will pursue the performance suggestions as well.

Thanks!