Author: Foxhound
Author Website:

Requirements: Extended eventhandlers (xeh) by Solus & Killswitch

Version: 1.03
Signed: Yes (server key included)

Short description:

Date: 2008-08-16 09:00


Comments: (1)
Rating:



 

4-the_captain_aigrenadierfix_1.jpg

AI Grenadier Fix
by
The_Captain


Description:
This addon corrects for an Arma bug that seems to have been present since grenade launcher sights were introduced. AI Grenadiers aim about 10 degrees too high when firing their grenade launchers. It seems as if their AI code raises their arms too high, probably having something to do with the memory points on the weapon. It was pointed out to me that "GL look" and "GL_Eye" are about 11 degrees offset from the direction of the barrel.

This addon adds an 'fired' eventhandler to every unit that changes the flight path of AI fired grenades to be 10 (or so) degrees lower than their original flight path, allowing grenadiers to hit their target almost every time.

The addon is essentially a hack, since it doesn't actually fix the problem, but instead corrects the aim of launched grenades. My hope is that the bug will be noticed and fixed officially in the next patch, so this addon is never actually needed.


Installation:
Clients and server both need the addon. Server needs it for server AI, clients need it for client AI.

Put TCN_grenadefix.pbo in your Arma addons (or mod folder) directory.
Put TCN_grenadefix_config.hpp in your arma DTA folder.
Put TCN_grenadetest.intro in your user missions folder.

For more information about how to make/use modfolders please have a look at our FAQ.


Included .pbo files:
TCN_GrenadeFix.pbo


Custom weapons:
The eventhandler only works with predefined weapons. To add your own weapons (or change the default settings), edit the TCN_grenadeTest_config.hpp and add your own types and their proper offsets. I'm not sure the offsets I included are correct, so feel free to change the default settings.


Notes:
AI With low skill levels (.25-.5) seem more willing to fire grenades, while highly skilled AI (>.75) tend to fire rarely at isolated infantry targets. To test the addon, try AI with lower skill levels.

The addon uses General Barron's GetPitchBank and SetPitchBank functions. My script is inefficient, as it first gets the pitch and resets it again. I plan to rewrite it doing a single vector transformation instead of running the getpitchbank/setpitchbank functions.

Because each weapon model is different, each offset must be defined separately. Checking ammo and muzzle type don't work: GP25's actually use 40mm ammo, and M16's and M4's both use M203Muzzle.

The addon does use a settings file in the DTA folder for custom weapons, and I think it throws an error if you try to run the game without the file. However, since I had to define weapon types explicitly, this does make it easier to add new weapons.


Known issues:
AI still think they're firing at their old elevation, so they may assume they can fire over the head of someone in front of them, while the script moves their grenade 10 degrees downward. Sometimes this results in friendly fire.


Version:
v1.0
- First release

v1.01
- Functions only compile once now, instead of once for every unit.

v1.02
- Fixed aiming offset being applied to all fire modes of grenadiers
- Added 2nd example mission showing grenadiers using both grenades and rifles.

v1.03
- Added server key (TCN) and signed addon
- Fixed possible unneeded text display in 1.02 (sometimes showed grenade name in chat when firing)


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: No tags