Home   Help Search Login Register  

Author Topic: Camera.sqs: "To get you started" tutorial.  (Read 10369 times)

0 Members and 1 Guest are viewing this topic.

Offline Brandon

  • Members
  • *
Camera.sqs: "To get you started" tutorial.
« on: 11 Mar 2007, 17:32:40 »
Code: [Select]
[code]Alright heres, a template for you to work from.

To start, when you make a camera you need to say this in the init field of the unit:

Code: [Select]
this exec "camera.sqs"
When you preview your mission, you will see a camera. Perfect! Now lets make a bloody nice video.

This is a script that goes inside your "mission name" folder in your ArmA profile directory. Examples:

Quote
C:\Documents and Settings\Brandon\My Documents\ArmA Other Profiles\Victor\missions\BombRun.Intro
or
C:\Documents and Settings\Brandon\My Documents\ArmA\missions\Movie1.Sara

Here is the script that should be inside your mission folder. Lets call this script "DesertCamera.sqs" inside mission name folder "Desert.Intro" (This script is done in Rahmadi)

Code: [Select]
~.001
ShowCinemaborder false
playmusic "atrack4"
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal", "back"]

;Camera1
_camera camPrepareTarget [2543.27,102474.47,14.93]
_camera camPreparePos [2543.27,2474.47,0.20]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera

;Camera 2
;The camera from camera 1 will move here.
_camera camPrepareTarget [2897.26,2863.37,-0.00]
_camera camPreparePos [2890.27,2908.17,7.26]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera

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

5 fademusic 0

; Exit this script
exit



Now here's a walk through on what each of those mean.
========================================================
Quote
~.001
ShowCinemaborder false --- No Border
playmusic "atrack4" --- Play music (from game, not your own music)
_camera = "camera" camcreate [0,0,0] --- Starting position of camera.
_camera cameraeffect ["internal", "back"] --- General Camera.sqs script requirement

;Camera1
_camera camPrepareTarget [2543.27,102474.47,14.93]  --- Camera's target/looking position.
_camera camPreparePos [2543.27,2474.47,0.20] --- Cameras position. (Not direction, simply the X,Y,Z where the camera is)
_camera camPrepareFOV 0.700 --- Frame of View. 0.700 is the default, any lower it will zoom in.
_camera camCommitPrepared 0 --- How long it will take camera to get here. Since its 1st camera. 0 is proper.
@camCommitted _camera
---  Waits until the camera is in position before it reads the next line in the script.

;Camera 2
;The camera from camera 1 will move here.
_camera camPrepareTarget [2897.26,2863.37,-0.00] --- New target.
_camera camPreparePos [2890.27,2908.17,7.26] --- New Position.
_camera camPrepareFOV 0.700 --- New Frame of View.
_camera camCommitPrepared 8 --- The camera will take 8 seconds to get here from camera 1.
@camCommitted _camera


_camera cameraeffect ["terminate", "back"]  --- Way last camera will disappear.
camdestroy _camera --- Finally, delete camera.

5 fademusic 0 --- Fade the music from playing in 5 seconds to a volume of 0 (Nothing).

; Exit this script
exit[/code]

The red text is the information given to you when you are in the game, in order to get this information, you need to hold CTRL + LFT CLIK. Then go into a wordpad and select paste or CTRL+V. . You will get something that looks like this:

Code: [Select]
;=== 11:01:35 (your PC's time when you took the camera position)
_camera camPrepareTarget  [2897.26,2863.37,-0.00]
_camera camPreparePos [15375.62,13710.77,1.59]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 5
@camCommitted _camera

That's exactly what I have in the red area above. And remember, having the ";" character in the beginning of a line in any script is NOT read by the game.

Some camera commands: (Controls when moving the camera)
+   Zoom in
-   Zoom out
8,6,2,4,5 (Numpad, Camera movement controls)
L (Turn off Crosshairs on screen)
F (Lock camera to a certain position)
You can also use your mouse/joystick to move the camera.

When you save the camera.sqs file, make sure that the file is not a TXT file. It may say ".sqs" at the end, but sometimes the .txt is hidden. If your script does not work, make sure it is a .sqs file. In order to make sure of this:

Go into your mission's main directory. Click Tools >> Folder Options >> View (tab) >> UNCHECK "Hide extensions for known file types" >> Then hit apply >> Look to make sure the camera file is not called "DesertCamera.sqs.txt", if it is change it simply to "DesertCamera.sqs" and hit OK to any popup warnings that appear. You may want to RECHECK "Hide extensions for known file types" later on.

You don't need to know how to script an entire camera sequence to make a good movie ether. I don't know how to script and check out what I made with JUST camera.sqs:
http://youtube.com/watch?v=-bjgsP6FoeE
http://youtube.com/watch?v=HvDJkiDd2BI
(Also check out my other videos from OFP that involve the same method of camera.sqs).

You can do anything!

Happy hunting!
« Last Edit: 18 Mar 2007, 08:42:01 by Brandon »

Offline Blanco

  • Former Staff
  • ****
Re: Camera.sqs: "To get you started" tutorial.
« Reply #1 on: 12 Mar 2007, 15:25:04 »
Quote
@camCommitted _camera --- A little help here  Blink

It means: wait until the camera is in postion before you read the next line in the script.

Why is this useful?
Here's an example that shows you what you can do without @camCommitted

Create a camerascene that fades out & in while the camera's moving.
An example :

Quote
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal", "back"]

_camera camPrepareTarget [82965.51,-56258.48,8713.93]
_camera camPreparePos [2826.49,2920.51,0.95]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera

_camera camPrepareTarget [76923.97,-63743.85,8717.76]
_camera camPreparePos [2882.09,2873.58,0.73]
_camera camPrepareFOV 0.700

; the camera will move for 12 sec but will fade out to black after 10 seconds. I dont use a @camCommitted command here because I don't want the camera to stop before it fades out.
_camera camCommitPrepared 12
~10
; the fade effect will only last for 2 seconds
cutText ["","BLACK OUT",2]
; pitch black for a second
~1
; the camera will move again for 12 sec but will fade in while the camera is already moving. Much nicer and smoother effect imo.
cutText ["","BLACK IN",2]
_camera camPrepareTarget [-34441.34,-89414.12,8724.06]
_camera camPreparePos [2917.65,2935.70,1.76]
_camera camPrepareFOV 0.788
_camera camCommitPrepared 0

_camera camPrepareTarget [-50700.71,-81058.36,8726.44]
_camera camPreparePos [2882.21,2870.75,0.76]
_camera camPrepareFOV 0.788
_camera camCommitPrepared 12
@camCommitted _camera

;... and so on.....


Also, another camera control key is DELETE to toggle the floating camera on & off.

Another very usefull tip:

You can record multiple camerapositions (in one take) while in camera mode.
First you have to assign a key to your fire button. (not one of the mousebuttons) Let's say you use the left CTRL key.
Now... while you are in camera mode you can record multiple camera postions by pressing the left CTRL key.

All these camerapositions are stored in txt file named "clipboard.txt" located in C:\documents and settings\#your_profile_name#\Local settings\Application data\Arma\...

The only things left to do are the creation of your camera at the beginning, the camcommitprepared values and the delays between each scene because those are not recorded.  8)
 



« Last Edit: 19 Mar 2007, 22:18:35 by Blanco »
Search or search or search before you ask.

Offline Ruffneck

  • Members
  • *
Re: Camera.sqs: "To get you started" tutorial.
« Reply #2 on: 14 Mar 2007, 08:13:08 »
Great tutorial!! I feel like Steven Spielberg

Just a question, I copied your bit on adding a track from the game. Where do you find and sample all the songs so i know which one will be suitable?

I tried inserting a trigger with the effect but it didnt work...

Also, my camera scence works when I preview the map in the editor but not when I try on a local server. Does this sometimes happen? OR am I overlooking something>??

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Camera.sqs: "To get you started" tutorial.
« Reply #3 on: 15 Mar 2007, 09:26:02 »
Thanks a million Brandon This is extremely helpful!

Offline Duke

  • Members
  • *
    • Lifesupporters.com
Re: Camera.sqs: "To get you started" tutorial.
« Reply #4 on: 19 Mar 2007, 20:09:38 »
This is a great tutorial but I do have a question, are there any thoughts on beefing it up a bit to include assigning a camera to a moving vehicle as well as triggering a cutscene?


Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re: Camera.sqs: "To get you started" tutorial.
« Reply #5 on: 21 Apr 2007, 12:40:26 »
Quote
Where do you find and sample all the songs so i know which one will be suitable
?

  What I did was to create  triggers, use the effect of all the music tracks, 1 to each trigger, then opened the mission.sqm to get the "official" name of the music track

Also, my camera scence works when I preview the map in the editor but not when I try on a local server. Does this sometimes happen? OR am I overlooking something>??
  How are you calling the script?  from a trigger or in the init?  If you want to trigger it then just make a trigger, set it up to be triggered however you want it, then in the on activation put
Code: [Select]
[] exec "nameofmovie.sqs".  That answers one of Duke's questions.
  Also don't forget that once you have finished making your movie, go back in the editor and remove the line
Code: [Select]
this exec "camera.sqs" from that unit.  You don't want camera.sqs running all the time, just when you are making your movie, and never use "camera.sqs" for a cutscene as it is an embedded script in the game, I personally use "title.sqs" for my intro cutscene and "nameofmovie.sqs" for any mid mission cutscenes, where I replace nameofmovie to something appropriate like "choppertakeoff.sqs"
  Good job explaining things brandon, and I hope I have helped with a little more details.
« Last Edit: 21 Apr 2007, 12:44:56 by bedges »

Offline Brandon

  • Members
  • *
Re: Camera.sqs: "To get you started" tutorial.
« Reply #6 on: 03 May 2007, 19:53:26 »
« Last Edit: 03 May 2007, 19:58:55 by Brandon »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera.sqs: "To get you started" tutorial.
« Reply #7 on: 04 May 2007, 19:14:08 »
After looking at the topic I'm still looking for the tutorial itself. Where is that tutorial?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Camera.sqs: "To get you started" tutorial.
« Reply #8 on: 04 May 2007, 19:22:28 »
first post in the thread is the tutorial, isn't it?  :dunno:

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera.sqs: "To get you started" tutorial.
« Reply #9 on: 04 May 2007, 20:21:37 »
ah, ok.

Offline Brandon

  • Members
  • *
Re: Camera.sqs: "To get you started" tutorial.
« Reply #10 on: 07 May 2007, 18:13:25 »
Are you implying something Mandoble?  :P

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera.sqs: "To get you started" tutorial.
« Reply #11 on: 07 May 2007, 18:30:30 »
My mistake, I was looking for an attachment doc or something like that.

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Camera.sqs: "To get you started" tutorial.
« Reply #12 on: 08 May 2007, 04:19:32 »
Is there a way to write cutscenes in SQF format or is SQS still required? 

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Camera.sqs: "To get you started" tutorial.
« Reply #13 on: 08 May 2007, 14:53:28 »
Yes, you can write them in sqf.
You just need to remember the semicolon after every line, sleep instead of ~ and waitUntil instead of @
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.