Jump to content
Sign in to follow this  
cobra4v320

Bullet Cam Script

Recommended Posts

bulletCam.sqf

Created by Big Dawg KS 2/14/2011 ARMA 2 v1.2

Updated by cobra4v320 4/5/2013 for ARMA 3 v1.3

Description:

Shows the path of the projectile in slow motion until it hits a target or another object. Singleplayer ONLY.

Parameter(s):

* To exit the camera ingame (while in flight), press the numberpad key zero.

* To add supported weapons, add MUZZLE classnames to _list (note: classnames are CASE SENSITIVE)

* To disable bullet cam, set BDKS_DisableBulletCam = true

* To disable blur effects, set BDKS_BulletCamNoBlur = true

* To disable particle effects, set BDKS_BulletCamNoParticleFX = true

* To change FOV (zoom), change the value of BDKS_BulletCamFOV (default 0.05). Ex: BDKS_BulletCamFOV = 0.3

* To change time acceleration, change the value of BDKS_BulletCamAccTime (default 0.5). Ex: BDKS_BulletCamAccTime = 0.2 (Note: AccTime only works in Singleplayer)

* 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]}

Example(s):

this addEventHandler ["fired",{_this call compile preprocessFileLineNumbers "bulletCam.sqf"}]

Mission Example:

http://rapidshare.com/files/3461154082/bullet%20camera.zip

Video:

BulletCam Script:

/*
Bullet Camera Script: bulletcam.sqf

Created By: Big Dawg KS 2/14/2011 ARMA 2 v 1.2
Updated By: Cobra4v320 4/5/2013 ARMA 3 v 1.3

Description:
Shows the path of the bullet in slowmotion until it hits a target or another object.

Parameter(s):
* To exit the camera ingame (while in flight), press the key for ironsights/optics (zero on numberpad)
* To add supported weapons, add MUZZLE classnames to _list (note: classnames are CASE SENSITIVE)
* To disable bullet cam, set BDKS_DisableBulletCam = true
* To disable blur effects, set BDKS_BulletCamNoBlur = true
* To disable particle effects, set BDKS_BulletCamNoParticleFX = true
* To change FOV (zoom), change the value of BDKS_BulletCamFOV (default 0.05). Ex: BDKS_BulletCamFOV = 0.3
* To change time acceleration, change the value of BDKS_BulletCamAccTime (default 0.5). Ex: BDKS_BulletCamAccTime = 0.2 (Note: AccTime only works in Singleplayer)
* 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]}

Example(s):
this addEventHandler ["fired",{_this call compile preprocessFileLineNumbers "bulletCam.sqf"}]
*/
if ((cursorTarget distance player) < 100 || (player findNearestEnemy position player) distance player < 100) exitWith {};

_projectile = nearestObject [_this select 0,_this select 4];

if (count _this >= 7) then {_projectile = _this select 6};

if (call {if (isNil "BDKS_DisableBulletCam") then {true} else {!BDKS_DisableBulletCam}}) then {

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 {

	// Add more weapons here
	_list = ["srifle_EBR_F","arifle_MXM_F","launch_NLAW_F","launch_RPG32_F","GL_3GL_F","EGLM","mortar_82mm"];

	_type = getText (configFile >> "CfgAmmo" >> (_this select 4) >> "simulation");
	_relPos = [0,-13,0.05];
	_fov = 0.05;
	_accTime = 0.5;

	if (!isNil "BDKS_BulletCamFOV") then {_fov = BDKS_BulletCamFOV};
	if (_type == "shotMissile" || _type == "shotRocket") then {_relPos = [0,-13,5.2]; _fov = 0.5; _accTime = 0.3};
	if (_type == "shotShell") then {_relPos = [0,-10,7.2]; _fov = 0.3; _accTime = 0.9};

	_disablePP = false;
	if (call {if (isNil "BDKS_BulletCamNoBlur")then{false} else {BDKS_DisableBulletCam}}) then {_disablePP = true};

	if (!isNil "BDKS_BulletCamAccTime") then {_accTime = BDKS_BulletCamAccTime};

	_enableParticles = true;
	if (call {if(isNil "BDKS_BulletCamNoParticleFX")then{false}else{BDKS_BulletCamNoParticleFX}}) then {_enableParticles = false};

	if ((_this select 2) in _list && !(isNull _projectile)) then {
		setAccTime _accTime;
		_camera = "camera" camCreate (getPos _projectile);
		_camera cameraEffect ["INTERNAL","BACK"];
		showCinemaBorder false;
		cutText ["","BLACK IN",0.2];
		_pSource = objNull;

		if (_enableParticles && _type == "ShotBullet") then { 
			_pShape = ["\a3\data_f\ParticleEffects\Universal\Universal.p3d", 16, 13, 3, 0];
			_pSize = [0.01,0.05];
			_pColor = [[1,1,1,0.08],[1,1,1,0.16],[1,1,1,0.03],[1,1,1,0]];

			_pSource = "#particlesource" createVehicleLocal (getPos _projectile);
			_pSource attachTo [_projectile,[0,0,0]];
			_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];
			_pSource setDropInterval 0.001;
		};

		[_projectile,_camera,_relPos,_fov,_pSource,_disablePP] spawn {

			_projectile = _this select 0;
			_camera = _this select 1;
			_relPos = _this select 2;
			_fov = _this select 3;
			_pSource = _this select 4;
			_disablePP = _this select 5;

			_cancel = false;

			while {alive _projectile && alive _camera && !_cancel} do {
				_camera camSetTarget _projectile;
				_camera camSetRelPos _relPos;
				_camera camSetFOV _fov;
				_camera camSetFocus [600,2];
				_camera camCommit 0;

				"RadialBlur" ppEffectAdjust [0.02,0.02,0.1,0.1];
				"RadialBlur" ppEffectCommit 0.01;

				if (!_disablePP) then {"RadialBlur" ppEffectEnable true};
				if (inputAction "optics" != 0) then {_cancel = true};

				sleep 0.001;
			};

			if (alive _camera && !_cancel) then {
				_camera camSetFocus [-(_relPos select 1),1];
				_camera camSetFOV (_fov * 1.6);
				_camera camCommit 1.5;

				"RadialBlur" ppEffectAdjust [0,0,1,1];
				"RadialBlur" ppEffectCommit 0.7;

				sleep 1.39;
			};

			cutText ["","BLACK OUT",0.1];
			sleep 0.11;
			setAccTime 1;
			"RadialBlur" ppEffectEnable false;
			_camera cameraEffect ["TERMINATE","BACK"];
			camDestroy _camera;
			if (!isNull _pSource) then {deleteVehicle _pSource};

			cutText ["","BLACK IN",0.6];
		};
	};
};
};

Change Log:

Added: "shotShell" so it will show the grenade launchers and mortars properly. AccTime sped up for those really high angle shots, FOV, and relative position changed.

Changed: "shotMissile" and "shotRocket" FOV and relative position changed.

Updated: the weapons list with sniper/DMR rifles, GL muzzle names, and both rocket launchers. You can add/delete whatever you want from this list.

Updated: example mission

Updated: uses precompiled function call.

Added: a check to see if enemies were within 100 meters of the player, if so the script will exit.

Note: I have attempted to contact Big Dawg KS, he hasn't been on here in over 7 months according to his profile and his private message box is full.

Edited by cobra4v320
Updated script
  • Like 3

Share this post


Link to post
Share on other sites

Nice! Could be fun to use to add some tension during missions were a single bullet should make a difference.

Share this post


Link to post
Share on other sites

This will be good for those sniper mission or when dropping GBUs when we get fighters.

Edited by cobra4v320

Share this post


Link to post
Share on other sites

Hello all, the script has been updated above, sorry no change log at the moment. :j:

Share this post


Link to post
Share on other sites

Script Update

Added: "shotShell" so it will show the grenade launchers and mortars properly. AccTime sped up for those really high angle shots, FOV, and relative position changed.

Changed: "shotMissile" and "shotRocket" FOV and relative position changed.

Updated: the weapons list with sniper/DMR rifles, GL muzzle names, and both rocket launchers. You can add/delete whatever you want from this list.

Updated: example mission

Updated: uses precompiled function call.

Edited by cobra4v320

Share this post


Link to post
Share on other sites

Do you think this could possibly implemented into say one of the side panel "monitors" or surfaces (don't know what to exactly call them)?

The separate video surfaces you can use for say helmet cams to view what other troops are doing, vehicle weapon optics, vehicle mirrors etc.

Share this post


Link to post
Share on other sites

You mean PIP picture in picture. Thats actually not a bad idea.

Share this post


Link to post
Share on other sites

Yes haha had a brainfart for the proper term, PiP.

Was actually debating attempting it then I saw your script here.

Share this post


Link to post
Share on other sites

Updated the script above, added a check to see if there were enemies within 100 meters of the player.

Share this post


Link to post
Share on other sites

Thanks cobra4v320, the updated camera script rocks! I love to use this on RPGs. It makes scoring a hit a lot more satisfying. :)

Share this post


Link to post
Share on other sites

Cobra nice work.

i dont have Arma3 nor can I play it because of OS incompatibility, however I did get this script into a test mission for Iron Front and it worked,

I just had to change the classnames for the weapons, but the only issue I have is I get a message that pops up on the first fire shot:

Warning Message: Cannot open object a3\data_f\particleeffects\universal\universal.p3d

Error: Model a3\data_f\particleeffects\universal\universal.p3d cannot be used as a sprite - it has not just one LOD level

Can i set this up as a trigger to disable the particle effects using this:

To disable particle effects, set BDKS_BulletCamNoParticleFX = true

or do you need to adjust something in the script to remove any references to Arma3?

Also in bd ks original script, in his test mission there was a fac operator with this code:

BD_BulletCam = compile preprocessFileLineNumbers "bulletcam.sqf"; BDKS_DisableBulletCam = false

How can i use a trigger with this code so that there no other units on the map, as without this code in a fac operator

in his test mission the bullet cam wouldn't work.

Share this post


Link to post
Share on other sites

Replace with: \ca\Data\ParticleEffects\Universal\Universal.p3d. I can add in a check to see whether or not you are playing arma 2 OA or ARMA 3.

Share this post


Link to post
Share on other sites

Yes that would be great.

Question, I'm wondering if it were possible to actually have visual on a bullet while its flying as the cam is just following something invisible,

something I'd like to see related to this is like this:

Where you have the camera rotate around the bullet, but again actually have a bullet.

Share this post


Link to post
Share on other sites

Love the script dude, I was up late last night sniping Russians on Tanoa laughing my ass off.  

Even better with the Bloodlust and headgore mods.  LOL.  

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×