Arma 3
AIBulletDeviation
I have tried to make a mod that can deviate the bullet from the muzzle veloctiy and decrease their accuracy better than adjust in AI skill
I have only 2 sqf file
fn_handleFired.sqf:
params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"];

if (isPlayer _unit || {!alive _projectile}) exitWith {};

// Grabbing muzzle velocity
private _origVel = velocity _projectile;
private _origSpeed = vectorMagnitude _origVel;

// Calculate 18% error from original aim
private _deviation = 0.18 * _origSpeed;

// Apply error to each vector axes velocity X/Y/Z
private _newVel = [
(_origVel # 0) + random [-_deviation, 0, _deviation], // X
(_origVel # 1) + random [-_deviation, 0, _deviation], // Y
(_origVel # 2) + random [-_deviation, 0, _deviation] // Z
];

// Apply new velocity
_projectile setVelocity _newVel;

And fn_init.sqf
if (!isServer) exitWith {};

// Add event handler to all existing AI units
{
if (!isPlayer _x) then {
_x addEventHandler ["FiredMan", AIBallisticDeviation_fnc_handleFired];
};
} forEach allUnits;

// Add logic for dynamically spawned units
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if (_entity isKindOf "CAManBase" && {!isPlayer _entity}) then {
_entity addEventHandler ["FiredMan", AIBallisticDeviation_fnc_handleFired];
};
}];

It works very well. The idea is the same with turret tweak mod on steam workshop
Maybe you guys can help me to apply the CBA adjust slide to the percent of error apply to each bullet?

Thank you