Jump to content
Sign in to follow this  
dummy_01

Camera will not follow player

Recommended Posts

For my outro I want to the camera to show the player getting away. At the end of my mission the player enters a vehicle and drives away. I use a trigger to activate the ending and outro. The outro starts when the player has driven about a hundred meters from where he entered the vehicle.

To accomplish what I want in my camera script I make the camera target the player and I give the camera's position relative to the player.

Like so:

_camera camSetTarget player;
_camera camSetRelPos [0,10,5];
_camera camCommitPrepared 0
@camCommitted _camera
~2

However, when the outro starts the camera is at the point where the player entered the vehicle - not where the player is. :(

It is like the player got left behind (invisible) at the point where he entered the car.

I can not solve this problem by exchanging "player" with the name of the car in the script, because the player has the choice between several vehicles for his escape.

Any good ideas on how to accomplish what I want for this outro?

Share this post


Link to post
Share on other sites

First of all you're mixing SQF and SQS together.

I believe your aim is to use SQS so the semi-columns at the end of lines 1 and 2 are obsolete ;)

Regarding your actual problem I'd try changing player to vehicle player:

_camera camSetTarget (vehicle player)
_camera camSetRelPos [0,10,5]
_camera camCommitPrepared 0
@camCommitted _camera
~2

Share this post


Link to post
Share on other sites

That worked! :D

Thank you!

Yes, you're right. I was mixing SQS and SQF. Don't know much about scripting. Learning new stuff everyday. The outro-file is named "outro.sqf", but contains lots of cut-and-paste code.

Share this post


Link to post
Share on other sites

Well, if you're not "spoiled" by SQS yet (:D) I'd suggest using SQF instead.

It's much more organized once you get the hang of it.

Here is how your code would look in SQF - you must execute it using execVM instead of exec ([] execVM "outro.sqf"):

_camera camSetTarget (vehicle player);
_camera camSetRelPos [0,10,5];
_camera camCommitPrepared 0;
waitUntil {camCommitted _camera};
sleep 2;

Share this post


Link to post
Share on other sites

Thank you, again!

Yes, I'm sure I will learn the SQF syntax, eventually.

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  

×