Home   Help Search Login Register  

Author Topic: Coup De Grace script (DELAYED)  (Read 2684 times)

0 Members and 1 Guest are viewing this topic.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Coup De Grace script (DELAYED)
« 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.
« Last Edit: 20 Sep 2007, 23:20:26 by Mandoble »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Coup De Grace script
« Reply #1 on: 19 Sep 2007, 22:44:04 »
Any way to have it addonless, or at least a similar effect?

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Coup De Grace script (TESTING)
« Reply #2 on: 20 Sep 2007, 02:06:57 »
On the speed issue, some suggestions:
  • Add a killed handler to each unit that can be "Coup De Graced" (which runs the second half of the code in your script), rather than having a separate script continually running for each one (even if it is only checking alive every couple of seconds, before falling through to that second half of the script).
  • Rather than continually checking the distance between every potential shooter and the corpse, just dynamically create a trigger that detects nearby enemies at the corpse's position. Alternatively, use "nearestObjects" (looking for "Man" objects) every so often for the same effect. This would also mean you wouldn't need to configure/maintain shooter lists.

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).
« Last Edit: 20 Sep 2007, 02:09:40 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Coup De Grace script (TESTING)
« Reply #3 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!
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...