Now we reach the Segment which deals with technical code for weaving your magic.
First of all SQS format is still the preferred scripting syntax in which to build a camera script (I'm not certain that SQF code has supporting commands for camera functions) So with this clear we must first create the canvas for what will be the foundation of our camera script. I truly recommend the use of the built in camera.sqs program offered by the games editor. (I will make referrence to it in this tutorial)
STEP 1 CREATE YOUR SCRIPT AND SAVE IT IN THE MISSION FOLDER
You do this by opening notepad and before anything else, you save it as camerascript.sqs. camerascript can of course be whatever you would like to name your script but you must add the .sqs to the end of it. Make sure you save it to your mission folder.
STEP2 CREATE THE CAMERA
We are now ready to create the camera.
_camera = "camera" camCreate [0,0,0]
- _camera = - This is the name that you are declaring(=) that you will refer to the camera by, inside your script.
- "camera"- This is the classname for the built in camera object we are creating.
- camCreate- This is the command to create an object with a predefined classname in game. (We are using it to create the object with the classname "camera".
- [0,0,0]- These are the x,y,z coordinates on the map where you are creating the "camera" object. 0,0,0 refers to the bottom left corner of the map. You may alternatively create the camera at any coordinate on the map provided you know the x,y,z numbers.
STEP 3 ADDING CAMERAEFFECT
_camera cameraEffect ["INTERNAL","BACK"]
- _camera- Again, we refer to the name of the "camera" class we declared earlier.
- cameraEffect- This is a command which defines the visual effect of the cameras perspective. Format of effect is ["Name","Position"]
| Name|| Position|
| Internal|| Top |
| External|| Left|
| Fixed with zoom||Front|
| || Back|
STEP 4 SCENE TRANSITION AND TEXT
- TitleCut - This is a command which allows you to print text on the screen and also control the transition from scene to scene.
- "" - The first quotes are where you type the text that you want flashed onto the screen.
- "Black In" - The second set of quotes can be used for the type of transition such as the one we show here or a print type which controls the text location on screen.
| Transition Type|| Definition|
| PLAIN|| Prints text in center of screen|
| PLAIN DOWN|| Prints text at bottom center of screen|
| BLACK|| Fades screen slowly from normal to black |
| BLACK FADED|| Instantly switches screen to black (no mistake here)|
| BLACK OUT|| Screen fades from normal to black in 2 seconds|
| BLACK IN|| Screen fades from black to normal in 2 seconds|
| WHITE OUT|| Screen fades from normal to white in 2 seconds|
| WHITE IN|| Screen fades from white to normal in 2 seconds|
There are 3 commands by which to print text on the screen...
TitleCut has been noted as obsolete in the COMREF but still functions as it should
CutText is identical to TitleCut and so serves at it's replacement. Therefore we will only discuss CutText & TitleText further.
TitleText is similar to CutText but with some noteworthy differences.
- Text printed with the CutText command will be removed at the end of the cutscene. Text printed with the TitleText command will carry over into the mission, outside of the cutscene.
If this were printed just before the cutscene script exited, it would disappear when the camera view was returned to the player.
| CutText ["The End","plain"]|
If this were printed just before the cutscene script exited, the text would still be visible after the camera view is handed back to the player.
| TitleText ["The End","plain"]|
TitleText ["This sentence will be printed first","plain"]
TitleText ["This sentence will be printed second","plain"]
The above code would print the first sentence and then 3 seconds later, replace it with the second sentence. The same would occur with the Cuttext command.
Titletext ["This sentence will be printed first","plain"]
CutText ["This sentence will be printed second","plain"]
The above code would print the first sentence and then 3 seconds later, print the second sentence on the same line without removing the existing text. Although this is obviously not what you would want to achieve, this occurence has its advantages. By implementing the "\n" (break) code, you can get creative with your text.
CutText ["Written and Produced by","plain"]
TitleText ["\nThe Staff at OFPEC","plain"]
The above code would print the first sentence and then 3 seconds later, print the second one right below it without removing the first sentence. If you were to repeat the same command while using the break code, it would still replace the existing text.
The time duration of the text printed by both commands is 20 seconds wether inside or outside the cutscene. To shorten the display time of the text for either command you will have to repeat the command with empty text quotes.
TitleText ["Monday morning 1400 hours","plain"]
The code above will display the first sentence and 3 seconds later, the text will disappear.
STEP 5 Positioning the camera
We have created the camera, added the effect, and transitioning. We now must place the camera where we need it to start. The best and most precise way to do this is by using the camera.sqs program within the editor. Within the editor, once you have your mission loaded, create a trigger set to repeated radio. Type in the OnActivation field "player exec "camera.sqs". Review the mission and then activate the radio. you are now inside the eye of the camera. Basic movement is similar to in game unit control but most importantly, the capture screen button is your "Fire" button. Move the camera into a position you want and then press the "Fire" button. You then Alt Tab back to desktop, navigate to your camera script and press Cntrl + V to paste it into the document. You should now see something similar to the code below.
_camera camPrepareTarget [-86735.77,8551.40,19.14]
_camera camPreparePos [13263.63,8848.29,3.56]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
- The first line is just a comment with the time that the screen was captured. You should change this comment to explain the shot a little as it would help you keep track within the script, where you are. It helps when you have to go back to change something later as well.
- In the second line, camPrepareTarget is the command which identifies what the camera is pointed at. In this case it is the x,y,z coordinates of the map. You could replace the array here with an object name that you have named in the editor to have the camera point at that named object.
- In the third line, camPreparePos is the command which identifies where the cameras position is located on the map using x,y,z coordinates. Often times, you can use the camera.sqs to find out the exact numerical coordinates needed for a specific array elsewhere.
- In the fourth line, camPrepareFOV is the command which records the Field of View or zoom magnification of the camera. (Adjusting this will not change the cameras position but rather its focus) The higher the number the larger the target.
- In the fifth line, camCommitPrepared is the command which sets the time it takes to get to the current cameras position, FOV, target, etc. 0 is an instantaneous screen change while lower numbers allow the viewer to see the camera moving to the camera position, FOV, target, etc.
- In the final line, camCommitted is a continous loop that checks the previous line for satisfaction. The script pauses here until the camera is in position, so the usual pause code "~" is not needed while this is present.
By not using any time delay codes between camera creation and this first position, we have created an instant transition from normal game view to the camera script. We can now either pause the script or place another position for which to allow the camera to move to.
WORK IN PROGRESS 12-7-08