Thanks for the reply. I'll look into that exitwith problem, but so far I haven't seen it fail even once. I guess there's a first time for everything, and at least the fix is easy. Penetration is something I have to test more, but if the A2 engine takes speed into account properly it shouldn't be a problem. Less speed -> worse penetration. Different types of ammunition was indeed a big shortcoming, and that's why... see blow
edit:
Right, new approach again
The above approach wasn't really that flexible in terms of different ammunition fired with the same weapon, so a new one was needed. Insted of specifying initial speed in the config I decided on a base-weapon for each calibre, with a velocityfactor of 1, and then factored other weapons of the same calibre in relation to this vs. their expected muzzlevelocity with standard ammunition. Ie. M16, the "base weapon" for 5.56x45, has a velocityfactor of 1, while a shorter-barreled M4 has a factor of 0.946. By default the 5.56x45 Stanags give these weapons a muzzlevelocity of 930 m/s, but now that of M4 would be 0.946*930 m/s = 879.78 m/s. All mags containing the same type of ammo also now give the same inital speed, ie. a G36 Mag doesn't have different speed compared to Stanags anymore.
Imho this is way more flexible than the above in terms of different ammunition, as ANY type of ammo could now be fired and barrel length would still affect the initial speed.
Attached is a sample addon and an examplemission. In the mission I've added a "fired" Eventhandler to the playerunit so that you get written feedback of the weapon, muzzle and muzzlevelocity every time you fire. This version of the addon also has the effect enabled on all infantrymen that are local to the player, just to see how it affects performance in large scale.
Download example mission and addon(Requires CBA)
Do not mirror