BioWare Atari
BioWare Info BioWare Games Support Forums Visit the BioWare Store
Neverwinter Nights Home
Neverwinter Nights Home

NWN 1: Scripting

New Topic    Post Reply


    Add this To My Topics

   Go To Bottom

Author Cutscene Tutorial 1.0 (first release)
Iruyun
Game Owner
Profile: IruyunNWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 30 Jun 2002
Posted: Wednesday, 04 November 2009 06:28AM
Cutscene Tutorial 1.0 (first release)
Written by Iruyun

----------------------
What is a Cutscene?
----------------------
A cut-scene is the control of characters, objects, and setting by way of scripting, constrained to using the PC as the camera man. Characters can be primary components of a scene (in which there is character interaction) but do not necessarily have to be there (perhaps during a description of a desolate setting).

----------------------
PC is the camera
----------------------
The fundamental constraint of a scene is that the camera viewpoint is always relative to the PC's location. In order to maximize control and flexibility of the camera, the camera-man (the PC) must always be in a dynamic mode (meaning the character must always be able to move freely and without any conflict – hostile creature attacking, stunned, etc). The PC is always one fundamental part of the scene: the camera. Because the PC can't be an actor and the camera in simultaneity (they technically can, but you relinquish camera control), it becomes necessary to derive a solution to this problem of dual-functionality.

----------------------
PC, a Camera Man AND Actor!
----------------------
The solution to this problem of dual-functionality is simple – clone the PC using the CopyObject() function, thus creating a controllable actor that looks identical to the PC. This gives the player the illusion that their character is part of the scene while still maintaining flexibility and control over the camera while using the real PC.

----------------------
Invisibility and Ghost Properties of the Camera Man
----------------------
Now that we have an actor that looks exactly like the PC and is a funnctional camera, we have to tackle the issue of making the camera-man (the PC) invisible. This means applying Invisibility and Ghost effects to the PC, enabling the PC to move about the scene completely invisibly and with the ability to move through other characters completely and unhindered.

However, there is an improved method to dealing with Camera Man properties, rolling both ghost and invisibility effects into one effect:

Code:

View Post/Code in separate window



Then, to remove the effect, create a function that removes extraordinary effects, given to you in the following form:

Code:

View Post/Code in separate window



In sum, we effectively used the CopyObject() command to clone the PC and after applying the Cutscene Effects to the PC, we have two different objects functioning as the character and as the camera.

----------------------
Controlling the Camera
----------------------
Using the camera is actually pretty simple. Use this snippet of code every time you want the camera angle to change.

AssignCommand(oPC, SetCameraFacing(A,B,C,D));
A = a float between 0.0 and 359.0 simulating North (90.0), East (0.0), South (270.0), and West (180.0)
B = distance from the PC
C = camera angle, between 1.0 (vertical sight/top down) and 89.0 (horizontal sight, looking forward)
D = type of camera transitions (SNAP, VERY_FAST, FAST, MEDIUM, SLOW, CRAWL)

It's nice to combine movement commands with camera facing commands, to create a “rolling” effect. In addition, SetCameraHeight() function can come in handy as well.

----------------------
Controlling Characters
----------------------
Use the AssignCommand() function to identify which character you want to do something, preceded by the DelayCommand() function to identify which point in time you want the character to execute the action. The basic actions include moving, jumping (instantaneous movement), speaking, and playing animations.
Code:

View Post/Code in separate window



A fully written snippet of this code would look like this:

Code:

View Post/Code in separate window



----------------------
Controlling the Camera Man
----------------------
Controlling the camera-man is usually comprised solely of the JumpToObject() and ActionForceMoveToObject() commands, as these actions jump immediately to the top of the action queue. This, combined with SetCameraFacing() function can be quite sexy.

----------------------
Note on DelayCommand() function
----------------------
The DelayCommand() function must always have a different time interval for all actions. There is a possible issue with issuing commands on the same moment in time, so to play it say, have an extremely small delay in terms of the following DelayCommand() function, exemplified here:

Code:

View Post/Code in separate window



The difference between these two actions is minimal, maintaining the sense of intended synchronicity.

----------------------
Setting Up the Cutscene
----------------------
Setting up the cutscene is critical to executing it properly. This means making sure all objects are in-place, including characters, the camera, and the actor playing the PC. Because we don't want the player to see us set up the cutscene, we use a FadeToBlack() or BlackScreen() function to “dim the lights” as the cutscene prepares itself. Then, during this “lights out” time, we have the opportunity to set up all the details for the cutscene. (Take 1 – 5 seconds to do this.) This includes removing the character UI for the PC using SetCutsceneMode(), copying the PC using CopyObject() and a faction function, making the PC the camera man by applying Invisibility/Ghost, and initializing the camera location, facing, and angle using JumpToObject() & SetCameraFacing(). Once all is set and ready, or, “pret”, use FadeFromBlack() to fade back into the cutscene.

----------------------
Triggering Cutscenes
----------------------
A cutscene can be triggered from any point where a script can be triggered. Common cutscene triggers include:

OnEnter() script (either on an Area or on a ground Trigger).
During a Dialogue
When a unique item is activated
When an item is acquired/unacquired
When a monster is killed
When an object is manipulated
When something is equipped
*Wherever a script can be triggered*

All of these are possible triggering events for a cutscene.

----------------------
EXAMPLE CUTSCENE
----------------------
A simple example of a cutscene follows. Use this as a guideline or a template. The conditions for this cutscene are not defined well at all, instead, gather the gist of it, and try cutscenes yourself until you understand the main points.

Code:

View Post/Code in separate window



Post-script Notes:

----------------------
Copying the PC
----------------------
Be sure to set the copied PC as neutral or friendly, because all copied object are initially hostile. You can use the ChangeToStandardFaction() function to accomplish this.

----------------------
Naming Conventions
----------------------
It is important to have a naming convention when designing a cutscene. I use the following naming convention, which makes it easy to identify which cutscene I'm on. I need to know three things:
the cutscene
the character being controlled
and the action they are going to perform (primarily movements (m) or jumps (j))

Cutscene, character, action, sequence

cutscene# _ character _ move/jump# =cs1_nasher_m1

----------------------
Combining Character Control and Camera Movement
----------------------
Often times, character control and camera movement are intertwined. This can create a sense of flow and unity through the cutscene. Flow is the how smooth the cutscene is executed while unity is the sense that all parts of the cutscene combine into one continuous piece.

----------------------
Single Player / Multiplayer
----------------------
Single player cutscenes are much easier to implement than multiplayer cutscenes due to the GetFirstPC() command, where as a cutscene in a multiplayer module has to keep track of more than one PC. Keeping track of all the characters involved in a cutscene can be done, but it requires a bit of extra scripting and possibly defining some new functions to simplify the ultimate cutscene experience.

----------------------
IN SUMMATION:
----------------------
Practice and experience makes perfect. Start simple, get more advanced. Have fun! If there are any flaws in this tutorial, please tell me.

Thanks, Iruyun
_________________
Struggles the Blog:
http://sols3xy.blogspot.com

& The Mod Making Team:
Click Here
  Profile: Iruyun   Send Message To: Iruyun
FunkySwerve
Game Owner
Profile: FunkySwerveNWN
NWN: SoU
NWN: HotU
NWN 2
Mass Effect PC


Joined: 19 Nov 2003
Posted: Thursday, 05 November 2009 02:28AM
No sense reinventing the wheel:

Click Here

Funky
_________________
Higher Ground

Higher Ground Legendary Level System for levels 41-60
  Profile: FunkySwerve   Send Message To: FunkySwerve
Iruyun
Game Owner
Profile: IruyunNWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 30 Jun 2002
Posted: Saturday, 07 November 2009 10:52AM
You're right. Gestalt goes through the entire NWN cutscene experience with lots of detail and provides a solid cutscene system.

But Shirley variety is the spice of life.

One thing is to invent something, another is to understand it.
_________________
Struggles the Blog:
http://sols3xy.blogspot.com

& The Mod Making Team:
Click Here
  Profile: Iruyun   Send Message To: Iruyun

New Topic    Post Reply

What do these icons mean?
Where can I learn how to use the forums?

Jump To:

Search Forums | Forums FAQ | Forum Archives

 

 

BioWare Store
Neverwinter Nights 2 Forums
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

View Latest Screenshots 

View Latest Screenshots
Hide/Show

Multiplayer Games at Neverwinter Connections

Today
Schedule a Game...



Current time is: (set time)
Sun, 22 November 2009 09:04AM

Hide/Show

Buy Premium Modules

Top NWN: HotU Modules:
1. Good vs Evil III
2. More...

Top NWN: SoU Modules:
1. Good vs Evil III
2. More...

Top CEP Modules:
1. The Lord of Terror The Diablo Campa...
2. More...

Top Modules - NWVault:
1. Hall of Fame
2. More...

Total Modules: 4423

Hide/Show

5,052,430 BioWare Users:
  40 Logged In
  3 Hidden
  144 Guests

708 Playing Online
  100% NWN
  101% NWN: SoU
  101% NWN: HotU

444 Registered Guilds

8,768,813 posts in forums

Newest Forum Topics:
1. Transfering Shepard's appearance (Mass Effect 2 General Discussion (No Spoilers Allowed))

2. Jade Empire's History (Jade Empire Xbox General Discussion (Spoilers Will Be Moved))

3. can't change language (Web Site Help)

4. which script launches the crafti... (NWN 1: Scripting)

5. Killing Morag (NWN 1: General Discussion (No Spoilers Allowed))