Jump to content
Sign in to follow this  
Big Dawg KS

Improved Bullet Cam Script v1.1

Recommended Posts

You can just paste this in the player's init:

this addEventHandler ["fired",{_this execVM "cam.sqf"}]

thx, it worked.

But as I change weapon it doesnt work anymore. (you can change weapons via menu to test all weapons and launchers.

What do I add to initialization to work with all weapons, or do i have to change something in script?

THX

Share this post


Link to post
Share on other sites
// To add supported weapons, add MUZZLE classnames to _list (note: classnames are CASE SENSITIVE).

// Alternatively, declare a global array called BDKS_BulletCamList with muzzle classnames. Ex:

// BDKS_BulletCamList = ["huntingrifle","Javelin"]

Muzzle names are usually identical to weapon classnames. They only differ if the weapon has multiple muzzles (ex: M16/M203 or AK/GP25).

Share this post


Link to post
Share on other sites

You can make a bulletcam using switchcamera and a very simple code.

In the vehicle / unit init:

this addEventHandler ["fired",{nearestObject [_this select 0,_this select 4] switchCamera "EXTERNAL"}]

To get camera back to player create a trigger, replace 'this' in activation with:

! alive cameraOn

and then in On Act.:

vehicle player switchCamera "INTERNAL";

Make sure you set the trigger to repeatable.

Does not require calling an external script, can be done completly in the editor.

See my video:

Share this post


Link to post
Share on other sites
How do I get this script to run? I'm new to mission making and scripting.

I'm with you - don't suppose there's any chance of writing n00b instructions on how to incorporate this into the game? I remember with one of the game modes for ArmA1 you had a menu to enable/disable the bulletcam which would be useful here.

Add to that how to make it work with tank shells etc? I'd like to see the trajectory of something fired from a big gun :)

Share this post


Link to post
Share on other sites
Here's a new (untested) version that will A. hopefully allow you to eliminate the problem where the script cannot acquire the projectile and B. allow you to define supported weapons without modifying the script (via a global variable).

Read the comments for details.

This is a beta (untested):

// Bullet Cam Script
// v1.2b
// cam.sqf
// Big Dawg KS
// 8/3/09
//
// Call via Fired EH, ex:
//   this addEventHandler ["fired",{_this execVM "cam.sqf"}]
//
// Alternatively, for higher velocity projectiles (where the script has trouble acquiring the projectile),
// call with this syntax:
//   this addEventHandler ["fired",{_this+(nearestObject [_this select 0,_this select 4]) execVM "cam.sqf"}]
//
// To exit the camera ingame (while in flight), press the key for ironsights/optics
//
// To add supported weapons, add MUZZLE classnames to _list (note: classnames are CASE SENSITIVE).
// Alternatively, declare a global array called BDKS_BulletCamList with muzzle classnames. Ex:
//   BDKS_BulletCamList = ["huntingrifle","Javelin"]
//
// 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]}
//------------------------------------------------------------------------------------------------

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

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

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 = ["M40A3","m107","M24","M4SPR","SVD","SVD_CAMO","ksvk","DMR","huntingrifle","SMAW","Javelin","SidewinderLaucher_F35","BombLauncherF35"];
if(!isNil "BDKS_BulletCamList")then{_list = BDKS_BulletCamList};

_type = getText (configFile >> "CfgAmmo" >> (_this select 4) >> "simulation");
_relPos = [0,-13,0.05];
_fov = 0.05;
if(!isNil "BDKS_BulletCamFOV")then{_fov = BDKS_BulletCamFOV};
if(_type == "shotMissile" || _type == "shotRocket")then{_relPos = [0,-13,2.2]; _fov = 0.5};

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

_accTime = 0.5;
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];
_cancel = false;

if(_enableParticles && _type == "ShotBullet")then{
	_pShape = ["\ca\Data\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;
};

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(_enableParticles)then{deleteVehicle _pSource};
cutText ["","BLACK IN",0.6];
};

};

};

Sorry for the offtopic, but where did you get those nice formatting colors from?

Share this post


Link to post
Share on other sites

Hi

Is it possible to adjust the code so it only gets called when a specific target is killed - like in an assassination mission when you only want to see the target die?

Arkon2

Share this post


Link to post
Share on other sites

How do us non-scripters implement this please?

I'm interested from the point of view of seeing exactly how far projectiles go...

Share this post


Link to post
Share on other sites
Tutorial == save the above text via any text editor, to a filename ending in .sqf (e.g. bulletcam.sqf)

place that file in the same directory as the saved mission file (i believe these are always called mission.sqm)

this is normally under /[your user profile]/missions/[missionname].[mapname]/

finally, in the init field of the player character put:

this addeventhandler ["fired",{_this execVM "bulletcam.sqf"}];

(with the name you have chosen in-place of 'bulletcam.sqf')

im not sure, but i think bullets stay alive based on time, and its 4, maybe 5 seconds. with a high powered rifle this equates to about 2.5km

Edited by OOPz

Share this post


Link to post
Share on other sites

nm about that...

btw this script is pure awesomeness, really love it

good work !

Edited by Igneous01

Share this post


Link to post
Share on other sites

can anyone upload a sample mission file using this script, thanks

Share this post


Link to post
Share on other sites

Here's one. I also made a few improvements to the (now almost 2 year old) script.

BD Bullet Cam demo

Please note: In this version I changed the way the script should be called (uses precompiled function call).

Share this post


Link to post
Share on other sites

thanks, possible to cancel the cam before the bullet /cam end? & is it possible to add this enable/disable cam option in mouse option menu?

Edited by WWIII

Share this post


Link to post
Share on other sites
thanks, possible to cancel the cam before the bullet /cam end? & is it possible to add this enable/disable cam option in mouse option menu?

See the comments in the script. The camera can be canceled using your optics/ironsights key. Enabling/disabling the camera (or its effects) can be acheived by any front-end, you just have to set some public variables.

Share this post


Link to post
Share on other sites

Hello,

I am trying to use this Bullet Cam script but I dont understand where I am suppose to place the line: if(local Spotter)then{Sniper setVariable ["BDKS_ShowBulletCamToPlayer",true]}.

I am trying to make it so When a OPFOR Jet Neophron shoots its AA missiles at my Helicopter it goes into Bullet Cam mode.

As my crew is flying in passenger in a Huron, they run into trouble with jets. I placed the missile item code into the weapons section and the init for my player.

Could somebody please explain to me how I could get this to work?

This is my First ever post on here, made the account just to ask this.

Please Help Fellow Armaholics.

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  

×