|
Another recent addition to Neverwinter Nights is the ability to fade the screen to and from black. Again, you need to be careful with this as once the player's screen is blacked out they won't be able to see anything unless you remember to cancel the fade at the end of the scene! The good news is that (by default) the GestaltStopCutscene will automatically cancel any remaining fades for you.
#include "in_g_cutscene"
void main()
{
// Find actors
object oPC = GetLocalObject(GetModule(),"cutsceneviewer");
object oFan = GetObjectByTag("mycutscene_actor");
// Start cutscene, fade in
GestaltStartCutscene (oPC,"mycutscene",TRUE,TRUE,TRUE,TRUE,2);
GestaltCameraFade (0.0, oPC, FADE_IN,FADE_SPEED_MEDIUM);
// Player delivers lines, then turns to face NPC
GestaltActionSpeak (1.0, oPC,
"Now is the winter of our discontent",
FORCEFUL,4.0);
GestaltActionSpeak (5.0, oPC,
"made glorious summer by this son of York",
ANIMATION_FIREFORGET_VICTORY2);
GestaltActionAnimate (5.0, oPC, NORMAL,2.0);
GestaltFace (9.2, oPC, 0.0,2,oFan);
// Move the NPC towards the player and congratulate him
GestaltActionMove (5.0, oFan, oPC,FALSE,1.0,4.0);
GestaltActionSpeak (9.0, oFan,
"That was quite a performance!",
ANIMATION_LOOPING_GET_MID,2.0);
// Fade to black and remove the NPC
GestaltCameraFade (12.0, oPC, FADE_CROSS,FADE_SPEED_MEDIUM,2.0);
GestaltDestroy (13.0, oFan);
// End cutscene
GestaltStopCutscene (15.0, oPC);
}
The first call of GestaltCameraFade happens right at the beginning of the cutscene (0.0 seconds) and performs a FADE_IN on the player using BioWare's standard FADE_SPEED_MEDIUM to decide how fast to adjust the brightness of the screen. The screen will automatically start completely black and then gradually fade in. It should be fully visible by about the time the player begins his first line.
One of the unique features of the Gestalt Cutscene Scripting System is the ability to add smooth, accurately timed camera movements to your cutscenes to give them that extra cinematic feel, using the GestaltCamera functions. A full description of these functions can be found elsewhere in this manual - see the index.
#include "in_g_cutscene"
void main()
{
// Find actors
object oPC = GetLocalObject(GetModule(),"cutsceneviewer");
object oFan = GetObjectByTag("mycutscene_actor");
// Find the direction the player's facing in at the start of the scene
float fFace = GetFacing(oPC);
// Start cutscene, fade in
GestaltStartCutscene (oPC,"mycutscene",TRUE,TRUE,TRUE,TRUE,2);
GestaltCameraFade (0.0, oPC, FADE_IN,FADE_SPEED_MEDIUM);
// Player delivers lines, then turns to face NPC
GestaltActionSpeak (1.0, oPC,
"Now is the winter of our discontent",
FORCEFUL,4.0);
GestaltActionSpeak (5.0, oPC,
"made glorious summer by this son of York",
ANIMATION_FIREFORGET_VICTORY2);
GestaltActionAnimate (5.0, oPC, NORMAL,2.0);
GestaltFace (9.2, oPC, 0.0,2,oFan);
// Move the NPC towards the player and congratulate him
GestaltActionMove (5.0, oFan, oPC,FALSE,1.0,4.0);
GestaltActionSpeak (9.0, oFan,
"That was quite a performance!",
ANIMATION_LOOPING_GET_MID,2.0);
// Fade to black and remove the NPC
GestaltCameraFade (12.0, oPC, FADE_CROSS,FADE_SPEED_MEDIUM,2.0);
GestaltDestroy (13.0, oFan);
// Camera movements
GestaltCameraMove (0.0,
fFace + 180.0,15.0,30.0,
fFace + 90.0, 12.0,50.0,
10.0,30.0,oPC);
// End cutscene
GestaltStopCutscene (15.0, oPC);
}
That's a lot of numbers! Luckily the camera functions (particularly GestaltCameraMove) are easier to use than you might think at first glance. The first number is (as usual) how long to wait before starting the camera movement. The first camera movement should start right at the beginning of the scene, so its delay is set to 0.0.
|