The_Captain 0 Posted August 15, 2008 As has been mentioned a few times, AI grenade launcher aiming seems to be buggy. AI tries to kill you and always manages to miss, usually by 20-100 meters, even at point blank range! Unless the target has a wall or hill behind it, AI grenadiers are pretty much useless. This eventually frustrated me to the point where I decided to see why their aiming was off, what the problem was, and how it could be corrected. So, here's... The Captain's AI Grenadier Fix EDIT: v1.01 had a nasty bug where all rifle fire from grenadiers got messed up. Download v 1.03 below! (Short) Youtube video of default behavior, and the fix: Download v1.03 from: Armaholic: http://www.armaholic.com/index.php?m=single&id=3656 ArmedAssault.info: http://www.armedassault.info/index.php?cat=news&id=1155 ePrison.de: http://www.eprison.de/files/148/4539 FileFront: http://files.filefront.com/TCN+Gre....fo.html Change Log: ---------- v1.03 - 08/16/2008 - Added server key (TCN) and signed addon, Fixed possible unneeded text display in 1.02 (sometimes showed grenade name in chat when firing) v1.02 - 08/15/2008 - Fixed aiming offset being applied to all fire modes of grenadiers. Added 2nd example mission showing grenadiers using both grenades and rifles. v1.01 - 08/15/2008 - Functions only compile once now, instead of once for every unit. v1.0 - 08/14/2008 Multiplayer: Can be used Server or Client side. (Server needs it for server AI, clients need it for client AI. Can be used just on a client, but fix will only affect that client's AI). MP Key uploaded to OFPEC: http://www.ofpec.com/tags/index.php?action=details&tag_id=1655 Requires Extended Init Eventhandlers addon. http://www.flashpoint1985.com/cgi-bin....=70816; Example mission included. 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 and thus they will always miss their target. 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. The eventhandler only works with predefined weapons. To add your own weapons (or change the default settings), edit the TCN_GrenadeFix_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. 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. Hopefully the aiming bug will be fixed in the next Arma patch. Bug List: --------- 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. Fixed in 1.02: All fire modes of the grenadelauncher had the offset applied, causing all rifle fire to hit the ground in front of the soldier. Fixed in 1.03: Occasional display of unnecessary globalchat text when grenadiers fired their weapons. Fixed. Notes: -------- 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. Troubleshooting thread: http://www.flashpoint1985.com/cgi-bin....1275057 Share this post Link to post Share on other sites
.kju 3245 Posted August 15, 2008 Good job buddy! One note <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">TCN_GrenadeFix_Init = "if (isNil 'TCN_GrenadeFix_Init') then { TCN_GrenadeInit = call compile preprocessFile ""\TCN_GrenadeFix\TCN_GrenadeInit.sqf""; };"; same for the others to avoid running the code multiple times. (from my limited scripting understanding ) What you could to is to use isKindOf class check and look for the model value instead of the class name. So it would still work for classes that inherit from ArmA class and still use the ArmA models. Share this post Link to post Share on other sites
Guest Posted August 15, 2008 **** Updated to version 1.01 **** Frontpaged at the Armaholic.com homepage. The Armaholic.com download page can be found here: http://www.armaholic.com/page.php?id=3655 Quote[/b] ]Multiplayer: Server or Client side. Does that mean that if this addon is installed on the server the clients don't need it? Or will the clients need it as well for their own AI? Share this post Link to post Share on other sites
The_Captain 0 Posted August 15, 2008 Thanks, Foxhound! Uploaded version 1.01 with Q's suggestion to improve performance. I'll look into the model checking, might be able to get that to work as well. Clients and server both need the addon. Server needs it for server AI, clients need it for client AI. I could write a serverside version that modifies all ai, even non local ones, but I don't trust the server in that case. Also, it might conflict if a client is also running the addon at the same time. Share this post Link to post Share on other sites
Guest Posted August 15, 2008 Ok, thanks for explaining that a bit more **mirror updated Share this post Link to post Share on other sites
NoRailgunner 0 Posted August 15, 2008 Thanks, now the grenadier AI should be more dangerous. Share this post Link to post Share on other sites
dmarkwick 261 Posted August 15, 2008 I get a "missing ';'" message on game bootup and on each mission start. But this is a great idea, look forward to using it Share this post Link to post Share on other sites
Commando84 0 Posted August 15, 2008 oh damn, i liked how they missed the grenade shoots more often It was more atmoshperic that way, but hey maybe its more realistic to be hit more often by grenades I'll give this a go this weekend. Share this post Link to post Share on other sites
Boborish 1 Posted August 15, 2008 Well it kinda sucks when he aims like 15 secs, fires and hits nothing. That way the grenadier is way more useless than a normal rifleman. Nice addon Captain. Share this post Link to post Share on other sites
The_Captain 0 Posted August 15, 2008 DMarkwick:When I was first uploading 1.01, I typoed when inputting Q's change, and quickly replaced it with a 'fixed' 1.01. It's possible you got the messed up interim version. All my fault. (The ArmaHolic (which I just downloaded to make sure), and the FileFront mirrors both have the correct v1.01. if you don't want to redownload, you can unPBO the addon, hop into config.ccp and make sure Extended_Init_Eventhandlers reads: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class Extended_Init_EventHandlers { class All { // run init function to process custom grenade offsets TCN_GrenadeFix_Init = "if (isNil 'TCN_GrenadeInit') then { TCN_GrenadeInit = call compile preprocessFile ""\TCN_GrenadeFix\TCN_GrenadeInit.sqf"";};"; // Compile functions for fired EH to quickly run when the shot is fired. TCN_GrenadeFix_Fix = "if (isNil 'TCN_GrenadeFix') then { TCN_GrenadeFix = compile preprocessFile ""\TCN_GrenadeFix\TCN_GrenadeFix.sqf"";};"; TCN_GrenadeFix_Fired="if (isNil 'TCN_GrenadeFired') then { TCN_GrenadeFired = compile preprocessFile ""\TCN_GrenadeFix\TCN_GrenadeFired.sqf"";};"; TCN_GrenadeFix_GetPitchAndBank="if (isNil 'TCN_GetPitchAndBank') then { TCN_GetPitchAndBank = compile preprocessfile ""\TCN_GrenadeFix\GetPitchAndBank.sqf"";};"; TCN_GrenadeFix_SetPitchAndBank="if (isNil 'TCN_SetPitchAndBank') then { TCN_SetPitchAndBank = compile preprocessfile ""\TCN_GrenadeFix\SetPitchAndBank.sqf"";};"; }; }; One of those lines (can't remember now) had an extra '};' thanks to my cut-paste magic. If you don't get an error on boot then you have a proper version. Sorry for the mix-up. Share this post Link to post Share on other sites
dmarkwick 261 Posted August 15, 2008 Aha, OK then I will re-download Thanks for the addon Share this post Link to post Share on other sites
Stavanger 0 Posted August 15, 2008 Mirror by ePrison.de <a href="http://www.eprison.de/files/148/4539" target="_blank">AI Grenadier Fix v1.01 by The Captain</a> Regards, Stavanger Share this post Link to post Share on other sites
The_Captain 0 Posted August 16, 2008 72hundred over at armed assault.info noticed that grenadier's normal rifles are messed up: When I added in custom rifle handling last night, the check for which "muzzle" was being fired got screwed up, so at the moment their regular rifle shots are screwy. Fixing it now. Sorry for the mix up. Edit: Fixed version 1.02: http://files.filefront.com/TCN+Gre....fo.html Share this post Link to post Share on other sites
big 0 Posted August 16, 2008 The Armaholic.com updated: AI Grenadier Fix v1.02 Share this post Link to post Share on other sites
The_Captain 0 Posted August 16, 2008 Thanks for the feedback and testing everyone. Okay, one last update, this one adds a dedicated server key for those who want to use it in multiplayer. Thanks for being patient with the updates, guys, as this is my first addon. (Normally I make missions...). learned a lot about the process of making an addon... more work than I expected. And all I wanted to do was write a simple vector transformation for grenades... Next time I make an addon I'll do all of these steps before I upload the first version (server key, better example missions, etc), as well as make sure to test any last minute changes before I pack something up! v1.03 will be the last major update of this fix. If I update/rewrite it, I'll simply put the update in the addon pack I'm thinking of releasing (see below for details). Change Log: ---------- v1.03 - 08/16/2008 - Added server key (TCN) and signed addon, Fixed possible unneeded text display in 1.02 (sometimes showed grenade name in chat when firing) http://files.filefront.com/TCN+Gre....fo.html Key uploaded to OFPEC: http://www.ofpec.com/tags/index.php?action=details&tag_id=1655 I'm considering also releasing a pack of addons with some of my other personal fixes. Some of these include: -Tank Damage Fix: Tank crews stay inside tanks when the tank's treads/engine have been disabled. Modifies fuel value to trick AI, without modifying vehicle configs (and therefore can apply automatically to all armored class vehicles). -Javelin fix: Adjusts trajectory of Javelin as it approaches a target to guarantee a hit (default BIS Javelins tend to miss by <1m or clip through vehicle). Much simpler than Mando's javelin replacement. -BMP/Shilka Commander Turret Fix - Adds a dummy weapon to the commander turret of these vehicles so you can look around when turned out, in external view, and use the command menu which is broken by default. -Disembark Troops from vehicles - The commander of a vehicle with more than one cargo position has an action which tells all AI troops under his command to disembark in order and move away from the vehicle. Useful when player is commander of a vehicle and needs troops to quickly exit without needing to use the command menu. -Keep original vehicle commander Fix - When a player gets in the back of a stryker (or any land vehicle), he becomes the 'commander', and the Ai crew turn out for some strange reason. This fix makes sure that when a player gets in a vehicle and his AI are the crew, that the AI retains command of the vehicle. Sound like a good set of addons for a small pack? Would you prefer the fixes bundled into one addon or separated so they could be used individually? Share this post Link to post Share on other sites
Dwarden 1125 Posted August 16, 2008 sounds nice i suggest you release each of them standalone + compiled pack ... also don't use FileFront only please. . usable free download services http://www.filedropper.com/ http://www.filefactory.com/ http://www.easy-share.com/ http://fileqube.com/ http://myfreefilehosting.com/ http://www.mediafire.com http://fileden.com/ http://badongo.com/ even moddb got own hosting servers less usable but quite popular http://www.fileplanet.com/ http://www.fileshack.com/ for australia/oceania i suggest mirror here http://www.ausgamers.com/contact/ i think this cover any userbase , filesizes and worldwide mirror needs:) Share this post Link to post Share on other sites
big 0 Posted August 16, 2008 The Armaholic.com has been updated: AI Grenadier Fix v1.03 Share this post Link to post Share on other sites
Stavanger 0 Posted August 16, 2008 Mirror updated from ePrison.de AI Grenadier Fix v 1.03 by The_Captain Regards, Stavanger Share this post Link to post Share on other sites
.kju 3245 Posted August 16, 2008 Interested in the tweaking addons. Share this post Link to post Share on other sites
popcorn 0 Posted August 16, 2008 Hey, great addon! I was trying to make RHS weapons work with this addon, so my TCN_GrenadeFix_config.hpp looks like this now: Quote[/b] ]//The Captain's grenadeFix Configclass TCN_GrenadeFixWeaponsCustom { class AK74GL { muzzles[] = {"GP25muzzle"}; offset = 10; }; class RHS_AK103GP30 : AK74GL {}; class RHS_AK103GP30Cobra : AK74GL {}; class RHS_AK103GP30PSO1 : AK74GL {}; class RHS_AKMGP25 : AK74GL {}; class RHS_AKS74GP25 : AK74GL {}; class RHS_AK74GP25 : AK74GL {}; class RHS_AKS74GP30 : AK74GL {}; class M16A2GL { muzzles[] = {"M203muzzle"}; offset = 9; }; class M16A4GL : M16A2GL {}; class M16A4_ACG_GL : M16A2GL {}; class M4GL { muzzles[] = {"M203muzzle"}; offset = 11; }; class M4A1GL : M4GL {}; }; Is it correct? I have no idea what im doing Share this post Link to post Share on other sites
dmarkwick 261 Posted August 16, 2008 Hey there TC, I'm still getting this error: but I have some more info. It looks like it's clashing with my DMSmokeGrenadeVB addon for some reason. Looking at the error message above, it looks like this Event Handler code from MY config: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class Extended_Fired_EventHandlers { // Define the classes to add inits to. class Man { DMVB_Init_Man="[_this select 0, _this select 4] execVM ""\DMSmokeGrenadeVB\Scripts\ViewBlockSmokeShell.sqf"";"; }; }; and this Event Handler code from YOUR config: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class Extended_Fired_EventHandlers { // Define the classes to add inits to. class Man { TCN_Fired_Man="_this call TCN_GrenadeFired"; }; }; are not being separated properly by a ";" in the Event Handler addon. Now, whether this is due to my config, your config, or a bug in the Event Handler addon, I don't know. All I can say is that as far as I can tell both our configs seem fine. Share this post Link to post Share on other sites
i0n0s 0 Posted August 16, 2008 @DMarkwick: Start updating your extended eventhandlers. They are outdated and are causing that problem. Share this post Link to post Share on other sites
dmarkwick 261 Posted August 16, 2008 @DMarkwick:Start updating your extended eventhandlers. They are outdated and are causing that problem. Ghaaaaah. I had thought of that & downloaded the most up-to-date ones. However, after searching through all my mod folders just now I found some old ones sneaking around in my SIX_Sense Pack1 folder. I guess they were older ones, I deleted them and things are all OK now Share this post Link to post Share on other sites
The_Captain 0 Posted August 17, 2008 Thanks for the mirrors and feedback everyone. @Popcorn: That method would work as long as the "muzzle" of the RHS weapons are also the same as the BIS muzzles. The muzzle definition only applies the fix if the weapon's muzzle is the same as the definition. I don't know if the RHS weapons use the same muzzle name (or if they inherit from BIS weapons), but I can go download them and check. (It would be in the cfgWeapons.cpp). I also don't know if the aiming offsets are the same, but since most AK's use the same launcher, it should also be 10. If you have a new muzzle name you could write: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class RHS_AK103GP30 : AK74GL { muzzles[] = {"[RHSMuzzleNAME]"}; }; DMarkwick: Gah, that's also my fault for not adding a semicolon in the exEH definition. Thanks for catching that. I've been using exEH 1.7 (and also using your smoke effects) so I didn't notice the error. Share this post Link to post Share on other sites
gL33k 0 Posted August 20, 2008 i have still the semi colon bug with version 1.03 and EH 1.7 Share this post Link to post Share on other sites