Advertisement
Lukegotjellyfihs

Arma 3 simple penetration calculation

Mar 24th, 2023
1,489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.26 KB | Gaming | 0 0
  1. //Saving screen space, not needed
  2. _x = configFile;
  3. //CfgMagazine
  4. _mag = "rhs_30rnd_545x39_7n10_ak";
  5. //CfgWeapon
  6. _weap = "rhs_weap_ak74m";
  7. //initSpeed on CfgWeapon (Overrides if greater than 0, acts as a multiplier if negative)
  8. _weapInitSpeed = getNumber (_x >> "CfgWeapons" >> _weap >> "initSpeed");
  9. //initSpeed on CfgMagazine is the default speed the bullet will be created with
  10. _magInitSpeed = getNumber (_x >> "CfgMagazines" >> _mag >> "initSpeed");
  11. _ammo = getText (_x >> "CfgMagazines" >> _mag >> "ammo");
  12. _ammoCaliber = getNumber (_x >> "CfgAmmo" >> _ammo >> "caliber");
  13.  
  14. _initSpeed = 0;
  15. if (_weapInitSpeed < 0) then {
  16.     //_weapInitSpeed is negative and therefore a multiplier, use abs() to get the positive result
  17.     _initSpeed = abs(_magInitSpeed * _weapInitSpeed)
  18. } else {
  19.     if (_weapInitSpeed > 0) then {
  20.         //_weapInitSpeed is overwriting the CfgMagazine initSpeed
  21.         _initSpeed = _weapInitSpeed;
  22.     } else {
  23.         //_weapInitSpeed is 0 and therefore does not affect the bullet speed
  24.         _initSpeed = _magInitSpeed;
  25.     }
  26. };
  27.  
  28. //https://community.bistudio.com/wiki/CfgAmmo_Config_Reference#caliber
  29. _rha_penetration = _initSpeed * _ammoCaliber * 0.015;
  30. //Returns 8.16231mm RHA equiv penetration in this case
  31. _rha_penetration;
Tags: SQF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement