View Full Version : [TSL] Scripting a walk-in, walk-out cutscene

Princess Artemis
06-07-2006, 06:40 PM
I've managed to do decently creating a brand new cutscene, but I'm having a little trouble working out how to get the camera to watch Exile walk into a room and then walk out after a few lines. Everything else works.

Anyway, this is the code for the cutscene:
void main() {
object oDisc = GetObjectByTag("Disciple", 0);
object oDustil = GetObjectByTag("HK47", 0);
object oPC = GetFirstPC();
int nParam1 = GetScriptParameter(1);
switch (nParam1) {
case 1:
SetLockOrientationInDialog(oDisc, 1);
SetLockOrientationInDialog(oDustil, 1);
SetLockOrientationInDialog(oPC, 1);
case 2:
AssignCommand(oPC, ActionMoveToLocation(Location(Vector(51.18177, 62.49011, 1.80000), 11.14967)));
DelayCommand(2.5, ActionResumeConversation());
case 3:
AssignCommand(oPC, ActionMoveToLocation(Location(Vector(49.47354, 58.39027, 1.80000), 274.21643)));
DelayCommand(2.5, ActionResumeConversation());

What this results in is usually a view of Dustil while Exile enters and Disciple watching Exile leave the room. All views of the Exile are when she's already in the room. Is there a way to specify a 1st POV? Or a camera switch to watch the entire room?

Or is this something I would do with the dialogue file?

Tupac Amaru
06-09-2006, 10:44 AM
First person view in cutscenes isn't possible, I'm afraid. In the .dlg there is the CameraAngle field that allows some control over cameras in a cutscene:
CameraAngle = 1 will show a close-up of the current speaker,
2 will show the current speaker and place the camera behind the player,
3 will show speaker and player from the side,
4 is used for animated cameras,
5 focuses on the player according to this thread (http://www.lucasforums.com/showthread.php?s=&threadid=145924#post1775401). I have never seen this work, though.
6 is used for placeable cameras.

I would try out CameraAngles 2, 3 and 5. Depending on how the player and speaker are positioned these may or may not look good. If those don't work well most modules already have some built-in placeable cameras you can try out. To use one of them you need to set CameraAngle to 6 and specify the CameraId in the corresponding dialogue node. Valid CameraIds can be found in the module .git, under CameraList.

If there is no good existing camera for the cutscene you can create your camera, either a placeable or an animated camera. This is not so easy, though. The tool AniCam (http://www.lucasforums.com/showthread.php?t=155460) by Jd allows you to make your own animated cameras. You specify several locations and angles that should be part of the animation.

A placeable camera shows a static view. Such cameras can be added with KT's module editor. Just right-click on the map to place a camera at that spot. If the map is not available for KT you have to edit the module .git file with K-Gff yourself. Don't use Bioware's GFFEditor for this as it can't handle the camera fields. Copy&paste an existing camera structure and change its CameraId to something unique.

Then you have to edit the postion, pitch and orientation for the camera.

The position consists of three values: x, y and z. You can get those with the whereami armband.

Pitch allows to tilt the camera up and down and is measured in degrees. 0 will make it look down on the floor, 90 is a horizontal view.

Panning the camera to the left or right (rotating around the z-axis) is done in the orientation field. The game doesn't use an angle, but quaternions for this. With KT all you have to do is specify the roll angle and it will do the conversion to quaternions. Otherwise you have to calculate the four orientation values yourself:
Field 1 = cos(angle / 2)
Field 2 and 3: always leave at 0
Field 4 = sin(angle / 2)

angle = 0 points the camera in the direction of the y-axis. The angle is measured counter-clockwise in degrees from that point. At least it's been that way in the modules I have modded. The formula does not work if you want to rotate the camera around more than one axis.

Other fields for a camera:
Height: is added to the z-value.
FieldOfView: works like a zoom. Standard values seem to be 50-60.
MicRange: no idea. Best left at 0 I guess.

Since the .git file is modified it needs to be repackaged together with the .ifo and .are into a .rim file and the .rim placed into the Modules folder. The camera won't work if you have already entered that module before either.

Nice Details... consider this stickied in the Tutorial Section ;) ~ ChAiNz.2da

Princess Artemis
06-10-2006, 07:41 AM
Thanks for the information. I ended up going about it in an entirely different way, but I sincerely appreciate your effort. I'm going to write up another cutscene, and I'm sure that the camera will become an issue again.