Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. /*
  2. Bullet Camera Script: bulletcam.sqf
  3.  
  4. Created By: Big Dawg KS 2/14/2011 ARMA 2 v 1.2
  5. Updated By: Cobra4v320 3/26/2013 ARMA 3 v 1.3
  6.  
  7. Description:
  8. Shows the path of the bullet in slowmotion until it hits a target or another object.
  9.  
  10. Parameter(s):
  11. * To exit the camera ingame (while in flight), press the key for ironsights/optics (zero on numberpad)
  12. * To add supported weapons, add MUZZLE classnames to _list (note: classnames are CASE SENSITIVE)
  13. * To disable bullet cam, set BDKS_DisableBulletCam = true
  14. * To disable blur effects, set BDKS_BulletCamNoBlur = true
  15. * To disable particle effects, set BDKS_BulletCamNoParticleFX = true
  16. * To change FOV (zoom), change the value of BDKS_BulletCamFOV (default 0.05). Ex: BDKS_BulletCamFOV = 0.3
  17. * To change time acceleration, change the value of BDKS_BulletCamAccTime (default 0.5). Ex: BDKS_BulletCamAccTime = 0.2 (Note: AccTime only works in Singleplayer)
  18. * To make another unit's (other than local player) bullet cam show for the local player, set unit variable BDKS_ShowBulletCamToPlayer = true, ex: if(local Spotter)then{Sniper setVariable ["BDKS_ShowBulletCamToPlayer",true]}
  19.  
  20. Example(s):
  21. this addEventHandler ["fired",{_this call compile preprocessFileLineNumbers "bulletCam.sqf"}]
  22. */
  23.  
  24. _projectile = nearestObject [_this select 0,_this select 4];
  25.  
  26. if (count _this >= 7) then {_projectile = _this select 6};
  27.  
  28. if (call {if (isNil "BDKS_DisableBulletCam") then {true} else {!BDKS_DisableBulletCam}}) then {
  29.  
  30. if ((_this select 0) == vehicle player || call {if (isNil {(_this select 0) getVariable "BDKS_ShowBulletCamToPlayer"}) then {false} else {(_this select 0) getVariable "BDKS_ShowBulletCamToPlayer"}})then {
  31.  
  32. // Add more weapons here
  33. _list = ["srifle_EBR_F","launch_RPG7_F","arifle_MXM_F","launch_NLAW_F","launch_RPG32_F","GL_3GL_F","EGLM","mortar_82mm","cannon_125mm","cannon_105mm","cannon_120mm"];
  34.  
  35. _type = getText (configFile >> "CfgAmmo" >> (_this select 4) >> "simulation");
  36. _relPos = [0,0,0.05];
  37. _fov = 0.01;
  38. _accTime = 0.1;
  39.  
  40. if (!isNil "BDKS_BulletCamFOV") then {_fov = BDKS_BulletCamFOV};
  41. if (_type == "shotMissile" || _type == "shotRocket") then {_relPos = [4,-8,4]; _fov = 0.6; _accTime = 0.1};
  42. if (_type == "shotShell") then {_relPos = [0,0,0]; _fov = 0.6; _accTime = 0.1};
  43.  
  44. _disablePP = false;
  45. if (call {if (isNil "BDKS_BulletCamNoBlur")then{false} else {BDKS_DisableBulletCam}}) then {_disablePP = true};
  46.  
  47. if (!isNil "BDKS_BulletCamAccTime") then {_accTime = BDKS_BulletCamAccTime};
  48.  
  49. _enableParticles = true;
  50. if (call {if(isNil "BDKS_BulletCamNoParticleFX")then{false}else{BDKS_BulletCamNoParticleFX}}) then {_enableParticles = false};
  51.  
  52. if ((_this select 2) in _list && !(isNull _projectile)) then {
  53. setAccTime _accTime;
  54. _camera = "camera" camCreate (getPos _projectile);
  55. _camera cameraEffect ["INTERNAL","back"];
  56. showCinemaBorder false;
  57. cutText ["","BLACK IN",0.2];
  58. _pSource = objNull;
  59.  
  60. if (_enableParticles && _type == "ShotBullet") then {
  61. _pShape = ["\a3\data_f\ParticleEffects\Universal\Universal.p3d", 16, 13, 3, 0];
  62. _pSize = [0.01,0.05];
  63. _pColor = [[1,1,1,0.08],[1,1,1,0.16],[1,1,1,0.03],[1,1,1,0]];
  64.  
  65. _pSource = "#particlesource" createVehicleLocal (getPos _projectile);
  66. _pSource attachTo [_projectile,[0,0,0]];
  67. _pSource setParticleParams [_pShape,"","Billboard",1,0.3,[0,0,0],[0,0,0],0,1,0.79,0.18,_pSize,_pColor,[1000],100,0.01,"","",_projectile,360];
  68. _pSource setDropInterval 0.001;
  69. };
  70.  
  71. [_projectile,_camera,_relPos,_fov,_pSource,_disablePP] spawn {
  72.  
  73. _projectile = _this select 0;
  74. _camera = _this select 1;
  75. _relPos = _this select 2;
  76. _fov = _this select 3;
  77. _pSource = _this select 4;
  78. _disablePP = _this select 5;
  79.  
  80. _cancel = false;
  81.  
  82. while {alive _projectile && alive _camera && !_cancel} do {
  83. _camera camSetTarget _projectile;
  84. _camera camSetRelPos _relPos;
  85. _camera camSetFOV _fov;
  86. _camera camSetFocus [600,2];
  87. _camera camCommit 0;
  88.  
  89. "RadialBlur" ppEffectAdjust [0.02,0.02,0.1,0.1];
  90. "RadialBlur" ppEffectCommit 0.01;
  91.  
  92. if (!_disablePP) then {"RadialBlur" ppEffectEnable true};
  93. if (inputAction "optics" != 0) then {_cancel = true};
  94.  
  95. sleep 0.001;
  96. };
  97.  
  98. if (alive _camera && !_cancel) then {
  99. _camera camSetFocus [-(_relPos select 1),1];
  100. _camera camSetFOV (_fov * 1.6);
  101. _camera camCommit 1.5;
  102.  
  103. "RadialBlur" ppEffectAdjust [0,0,1,1];
  104. "RadialBlur" ppEffectCommit 0.7;
  105.  
  106. sleep 1.39;
  107. };
  108.  
  109. cutText ["","BLACK OUT",0.1];
  110. sleep 0.11;
  111. setAccTime 1;
  112. "RadialBlur" ppEffectEnable false;
  113. _camera cameraEffect ["TERMINATE","BACK"];
  114. camDestroy _camera;
  115. if (!isNull _pSource) then {deleteVehicle _pSource};
  116.  
  117. cutText ["","BLACK IN",0.6];
  118. };
  119. };
  120. };
  121. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement