Jump to content
Sign in to follow this  
yyccccc

camera to follow anything you fire

Recommended Posts

Code Sample

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

setacctime 0.5;

_camera = "camera" camCreate (getpos _projectile);

_camera cameraeffect ["internal", "back"];

while{alive _projectile && alive _camera}do

{

_camera camSetTarget _projectile;

_camera camSetRelPos [0,-13,1.2];

_camera camCommit 0;

sleep 0.001;

};

if(alive _camera)then{sleep 1};

_camera cameraeffect ["terminate", "back"];

camdestroy _camera;

setacctime 1;

Edit: Also remember this in the unit's init line:

Code Sample

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

question 1 : sometimes the camera appearing at the sea, what is the matter?

question 2 : when I play as a M1A1 gunner how can I stop friendlyAi from using the camera follow script?

Share this post


Link to post
Share on other sites

1. You cannot always guarantee that the projectile will be found. If it's not found, then getPos will be [0,0,0] which is at sea.

Unfortunately they didn't add the extra param's of vbs2 in fired EH.

Add a safeguard:

if (isNull _projectile) exitWith {player sideChat "Projectile could not be tracked"};

2. Add a check something like:

if (gunner (_this select 0) != player) exitWith {};

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  

×