PDA

View Full Version : In-game cut-scene creation


blawk
05-08-2006, 10:38 AM
Hi,

I've got my stormtroopers to work as well as Darth Vader NPC and now I need to work on an in-game cut-scene like the one in 262TEL right after loading it for the first time (with Atris and the Handmaidens). I would like to know about the functions/code involved on making a NPC be the "leader" of a group, and let the others follow him towards another NPC. Also, on fade in/fade out and sound effects playing.

For the cut-scene dialog I guess it's just a matter of creating one, assigning the speaker/listener settings and set up the animations.

Any help appreciated.

BTW, I found this in the scripts.bif archive. Might be useful for someone:

//:: a_startgas
/*
Gases the room and
kills all humans
*/
//:: Created By: Preston Watamaniuk
//:: Copyright (c) 2002 Bioware Corp.

#include "k_inc_debug"
#include "k_inc_utility"

void main()
{
UT_GasRoom("Xterminal", 10.0);
}


and for using within heartbeat event scripts:


// self-explanatory
GN_WalkWayPoints();
// same thing but adding a 1 second delay
GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_DEACTIVATE , FALSE);
ClearAllActions();
DelayCommand(1.0, GN_WalkWayPoints());


Cheers and many thanks in advance.

Pavlos
05-08-2006, 12:19 PM
A cutscene is basically just a dialogue, as you said, with a load of scripts and animations thrown in (If you want it to look flashy :)). What exactly do you need help on?

ChAiNz.2da
05-08-2006, 01:26 PM
As Pavlos has already stated.. an in-game cutscene is just a dialogue sequence with all the extras added into the proper fields.

My Kreia mod has a new cutscene in it (feel free to dissect it).. along with the many others that can be extracted with KotOR Tool (http://kotortool.starwarsknights.com/) from the original game.

Be SURE to use tk102's DLGEditor (http://www.starwarsknights.com/tools.php#de) as it provides all the fields (animations, speaker, sounds, etc.) you'd need to adjust with a nice gui interface and dropdown menus :)

My Kreia mod in case you wanted to dissect it's cutscene:
http://www.lucasfiles.com/index.php?s=&action=file&id=1304

^^^^
If you're just wanting to dissect, I wouldn't bother installing it unless you're wanting to play it ;)

The .dlg file in particualr is the: "kds_robedone_dlg.dlg" located in the tslpatchdata folder.

----------------

As for being able to setup an NPC as leader.. yes.. I believe it would be possible. Without having the app in front of me (at work) I can't really be specific, but most of the work will be just setting whose the speaker, and whose the listener..

Creating a script whereas the listener's follow the speaker I'm sure could be posted (with more info) by some of the more talented scripters here at the boards ;) (I for one am NOT one of those.. hehehe)

blawk
05-08-2006, 01:31 PM
A cutscene is basically just a dialogue, as you said, with a load of scripts and animations thrown in (If you want it to look flashy :)). What exactly do you need help on?

A few questions came up:

1. How do you actually *get to see* the cut-scene in game? With PlayMovie() it's easy when those are pre-rendered movies in BIK format but no idea on in-game ones.

2. How do you use a concrete room inside a specific area for the cutscene?
3. If for example, a group of 3 stormtroopers and one leader needs to cross a door and face another NPC, then -dialog starts-, etc... how is that done/managed by the game? Do I need to "open" the door within the script or that's done automatically?

I need to know how to move NPCs towards another one, like first running and then walking/stopping progressively. Also on interaction with placeables. Like a computer terminal.

It doesn't help that when I warp to the new module, placeables aren't spawned :(. Maybe I did a mistake when editing but I really don't know what's going on about that.

Cheers.

blawk
05-08-2006, 01:35 PM
As Pavlos has already stated.. an in-game cutscene is just a dialogue sequence with all the extras added into the proper fields.

My Kreia mod has a new cutscene in it (feel free to dissect it).. along with the many others that can be extracted with KotOR Tool (http://kotortool.starwarsknights.com/) from the original game.

Be SURE to use tk102's DLGEditor (http://www.starwarsknights.com/tools.php#de) as it provides all the fields (animations, speaker, sounds, etc.) you'd need to adjust with a nice gui interface and dropdown menus :)

My Kreia mod in case you wanted to dissect it's cutscene:
http://www.lucasfiles.com/index.php?s=&action=file&id=1304

^^^^
If you're just wanting to dissect, I wouldn't bother installing it unless you're wanting to play it ;)

The .dlg file in particualr is the: "kds_robedone_dlg.dlg" located in the tslpatchdata folder.

----------------

As for being able to setup an NPC as leader.. yes.. I believe it would be possible. Without having the app in front of me (at work) I can't really be specific, but most of the work will be just setting whose the speaker, and whose the listener..

Creating a script whereas the listener's follow the speaker I'm sure could be posted (with more info) by some of the more talented scripters here at the boards ;) (I for one am NOT one of those.. hehehe)


Many thanks for the pointers! Helpful as always :)
I sent the reply to Pavlo right before reading your one. I'll check your mod.

Cheers.

edit 1: What's the purpose of the information in "Cutscene model" fields inside DLGEditor? and AnimatedCut check box?

ChAiNz.2da
05-08-2006, 03:03 PM
edit 1: What's the purpose of the information in "Cutscene model" fields inside DLGEditor? and AnimatedCut check box?
I couldn't quite figure that out myself at the time.. hehehe..

BUT, my hunch is that you have to list those "players" if you intend to use/alter the stunt model versions within the available animations list :giveup:

What I DO know, is that messing with them can cause conflicts (if you're adjusting pre-made cutscenes).. so be sure to write down the "before I started messing" values ;)

I had to mess with those when I was experimenting on doing a different cutscene involving Kreia's Fall.. her stunt saber was making a "guest appearance" unless I messed with the values (and script) calling the model to be placed.. (the saber that goes flying from her hand when Force Pushed)

In short (in case you made it this far).. Don't mess with them for now until you've exhausted or come into problems with your cutscene. I don't believe you'll need to add anything to those fields to be honest..

blawk
05-08-2006, 03:31 PM
I couldn't quite figure that out myself at the time.. hehehe..


Actually, AnimatedCut isn't enabled for the dialog I downloaded from pcgamemods.com (Kreia's Fall). That makes me feel confused, and certainly worried about the point of that setting.



BUT, my hunch is that you have to list those "players" if you intend to use/alter the stunt model versions within the available animations list :giveup:



I just don't understand what you mean with that :P
All it needs is, apparently, the speaker tag defined right?



What I DO know, is that messing with them can cause conflicts (if you're adjusting pre-made cutscenes).. so be sure to write down the "before I started messing" values ;)



No, since I made the first question, I was talking about a cut-scene made from the scratch, hence the doubts and all that stuff :D



I had to mess with those when I was experimenting on doing a different cutscene involving Kreia's Fall.. her stunt saber was making a "guest appearance" unless I messed with the values (and script) calling the model to be placed.. (the saber that goes flying from her hand when Force Pushed)



Is this within kreiaend script or where? The stuff I got from pcgamemods seems to be the one you're talking about, but I'm not sure. When you say model, what do you mean concretely? Aren't we dealing "in-game"? (nothing should be needed except dialog+scripts).

I'm confused :D



In short (in case you made it this far).. Don't mess with them for now until you've exhausted or come into problems with your cutscene. I don't believe you'll need to add anything to those fields to be honest..

OK, I'll try with some other stuff then because this cutscene has both parties talking, not just one.
BTW, I don't think Kreia's Fall can be used really like an in-game cutscene. It's pre-redenred *completely*. Nothing is passed to the game engine in fact. And that makes me think that something is just plain useless in there :( (as in moding-related help/reference terms).

Thanks again for the help!

Cheers.
PS: I promise to show a video on the mod progress as soon as I get the time for it!

ChAiNz.2da
05-08-2006, 03:50 PM
Actually, AnimatedCut isn't enabled for the dialog I downloaded from pcgamemods.com (Kreia's Fall). That makes me feel confused, and certainly worried about the point of that setting.Like I said, I'm still not too positive about the settings, but off or on seemed to make no effect for anything that I did.. however, I may not have used a particular function that neccessitated this check box ;) Messing with the cutscene model however, did have an effect (to an extent)...
I just don't understand what you mean with that :P
All it needs is, apparently, the speaker tag defined right?Not necessarily.. there are stunt models used for various cutscenes in the game that are used ONLY for the cutscenes.. that's what lead me to my "guess" (which is still a guess mind you.. hehehe). Per example Sion's beating the heck out of Kreia contains animations that aren't used anywhere else in the game.. The flying saber is another one (which is actually labeled stuntsaber).. etc.
BTW, I don't think Kreia's Fall can be used really like an in-game cutscene. It's pre-redenred *completely*. Nothing is passed to the game engine in fact. And that makes me think that something is just plain useless in there :( (as in moding-related help/reference terms). No, there is an un-rendered (in-game) version that still lives in the game files.. stoffe -mkb- was able to salvage it and make it available for those of us who were wanting to fiddle with it ;) Everything is there except for the sweetened audio and it's rather bland.. I'm tweaking it so I can include it as an add-on for my Kreia Mod.. but timing is being real nasty (and playing Oblivion isn't exactly making me rush into sound work.. hehehe)

Thanks again for the help!

Cheers.
PS: I promise to show a video on the mod progress as soon as I get the time for it!Kewl! looking forward to it.... and seriously, I tend to talk "gibberish" alot, so If I'm not making sense let me know and I'll try to re-word anything I've said.. you won't hurt my feelings telling me to "stay off the sauce and try to make more sense man!" hehehe.. :xp:

Pavlos
05-09-2006, 02:56 PM
You will want to create a new on enter script for your module (Which can be extracted via KotOR Tool). Your on enter should consist of a check to see if it is a load from a save game (And if it is just a simple "return;" will suffice.) You will need to check a Global Boolean to see if your scene has been triggered before and then if it hasn't set the global and start a dialogue. It is basically as simple as that.

So it should look something like this. My syntax may not be perfect because I have not got KotOR installed at this moment and so cannot compile to check and I always seem to leave a closing brace off the end, but never mind.


void main() {
object oNPC1 = GetObjectByTag("MyNPC");
object oPC = GetFirstPC();
if (GetLoadFromSaveGame()) {
return;
}
object oEntering = GetEnteringObject();
if ((oEntering == oPC)) {
if (!GetGlobalBoolean("MyConvo_done")) {
SetGlobalBoolean("MyConvo_done", 1);
AssignCommand(oPC, ActionStartConversation(oNPC1, "MyCutscene"));
}
}

}

It really is as simple as that. If you have previous programming skills, which it seems you do, it is very easy to pick up KotOR's scripting language - or you can do it the hard way like me and learn this first before moving onto proper coding languages...

There are lots of useful things to use when scripting for cutscenes. Obsidian introduced the parameter system which has made things far, far easier to build. It means you just need to get the script parameter and then do something depending on that value. Something like this:

void main() {
int nParam1 = GetScriptParameter(1);
switch (nParam1)
{
case 0: //Do something
break;
case 1: //Do something else
}
}

Then you define the parameter in the dialogue file :). There are lots of other functions such as "ActionMoveToLocation()," "SetGlobalFadeIn()." If you want to make a cutscene the first stop you should make is nwscript's functions and if you like the generic include file's functions. I don't have time to give you anymore help but if you do need more, I shall be happy to oblige - as shall many others on these forums! :).

stoffe
05-09-2006, 04:37 PM
1. How do you actually *get to see* the cut-scene in game? With PlayMovie() it's easy when those are pre-rendered movies in BIK format but no idea on in-game ones.


Since the cutscene is run as a dialog you'd start the scene by initiating the dialog. You usually do this from the OnEnter event script of either the area in question (if it's a cutscene set) or from Trigger, if the scene should happen when the player (or any other character you determine) reach a specific spot in the area. You can of course start it from anywhere capable of running a script, such as another dialog, when using a door or a placeable or when something happens to an NPC as well. :)

The ActionStartConversation() is usually what you use to start a conversation from a script.


2. How do you use a concrete room inside a specific area for the cutscene?
3. If for example, a group of 3 stormtroopers and one leader needs to cross a door and face another NPC, then -dialog starts-, etc... how is that done/managed by the game? Do I need to "open" the door within the script or that's done automatically?


If it's a "new" area you make the easiest way is probably to place waypoints at the spots you wish your characters to move to, but you can also use the coordinates directly. If you use waypoints you can use the ActionMoveToObject() function to make the NPC move to it, or use ActionMoveToLocation() to move to a Location (xyz-vector + facing).

The standard AI of NPCs usually make them open doors if they bump into them, but for cutscenes it's probably better to do the door opening directly in your cutscene script, since it allows you a bit more control of what's happening. You usually do that something like this:


void OpenDoor(object oDoor) {
SetLocked(oDoor, FALSE);
AssignCommand(oDoor, ActionOpenDoor(oDoor));
}

void main() {
OpenDoor(GetObjectByTag("MyDoor"));
}


The standard way of doing a cutscene would be to use a dialog file as controller, where you do things in steps, where each dialog node represents a step. Animations and delays between steps are set on the dialog nodes directly, as well as any conversation going on within the cutscene. Then you usually have a cutscene script that handles things such as movements, effects, spawning/destroying characters etc. This script usually handles all actions for the scene, where you pass parameters from the dialog nodes calling it to determine what it should do. This way you can let the dialog file keep track of the progression and won't have to use any local or global variables for that.

Have a look in the nwscript.nss file located in scripts.bif. It has the signature for all script functions listed, usually along with a description of the function. It's the best reference available when writing NWScript scripts. :)


It doesn't help that when I warp to the new module, placeables aren't spawned :(. Maybe I did a mistake when editing but I really don't know what's going on about that.


How have you placed the placeables? With a script dynamically, or by adding them to the GIT file for the area? If it's with a script, make sure the script is actually run.

blawk
05-10-2006, 03:41 AM
Since the cutscene is run as a dialog you'd start the scene by initiating the dialog. You usually do this from the OnEnter event script of either the area in question (if it's a cutscene set) or from Trigger, if the scene should happen when the player (or any other character you determine) reach a specific spot in the area. You can of course start it from anywhere capable of running a script, such as another dialog, when using a door or a placeable or when something happens to an NPC as well. :)

The ActionStartConversation() is usually what you use to start a conversation from a script.



If it's a "new" area you make the easiest way is probably to place waypoints at the spots you wish your characters to move to, but you can also use the coordinates directly. If you use waypoints you can use the ActionMoveToObject() function to make the NPC move to it, or use ActionMoveToLocation() to move to a Location (xyz-vector + facing).

The standard AI of NPCs usually make them open doors if they bump into them, but for cutscenes it's probably better to do the door opening directly in your cutscene script, since it allows you a bit more control of what's happening. You usually do that something like this:


void OpenDoor(object oDoor) {
SetLocked(oDoor, FALSE);
AssignCommand(oDoor, ActionOpenDoor(oDoor));
}

void main() {
OpenDoor(GetObjectByTag("MyDoor"));
}


The standard way of doing a cutscene would be to use a dialog file as controller, where you do things in steps, where each dialog node represents a step. Animations and delays between steps are set on the dialog nodes directly, as well as any conversation going on within the cutscene. Then you usually have a cutscene script that handles things such as movements, effects, spawning/destroying characters etc. This script usually handles all actions for the scene, where you pass parameters from the dialog nodes calling it to determine what it should do. This way you can let the dialog file keep track of the progression and won't have to use any local or global variables for that.

Have a look in the nwscript.nss file located in scripts.bif. It has the signature for all script functions listed, usually along with a description of the function. It's the best reference available when writing NWScript scripts. :)


OK, many thanks once again. I've got a syntax highlighted version of nwscript.nss :)
I think I'm ready to get going with the cut-scene.


How have you placed the placeables? With a script dynamically, or by adding them to the GIT file for the area? If it's with a script, make sure the script is actually run.

I've added them to the GIT file using Kotor Tool's module editor. Hmm, I didn't extract any utc file from the RIM, maybe that's the reason? I just placed them in userpalette now and will test ASAP.

Cheers.

Darth333
05-10-2006, 12:22 PM
I've added them to the GIT file using Kotor Tool's module editor. Hmm, I didn't extract any utc file from the RIM, maybe that's the reason? I just placed them in userpalette now and will test ASAP.
I had this problem as well until I figured out that KT's module editor does not set the z coordinate. So your placeables are probably somewhere below or above the walkmesh. You will have to use the whereami armband to fix that: http://www.starwarsknights.com/tools.php (note that this is not a problem with creatures: you can put any z coordinate and they will always be placed correctly. )

Of course, you also have to make sure that your .utp files are in your .mod file (preferably) or your override folder.

blawk
05-10-2006, 02:00 PM
I had this problem as well until I figured out that KT's module editor does not set the z coordinate. So your placeables are probably somewhere below or above the walkmesh. You will have to use the whereami armband to fix that: http://www.starwarsknights.com/tools.php (note that this is not a problem with creatures: you can put any z coordinate and they will always be placed correctly. )

Of course, you also have to make sure that your .utp files are in your .mod file (preferably) or your override folder.

OK, many thanks! I'll try to fix this now. I even used free-look to check if my computer terminals were flying around the room :D

I guess they were really right under Exile's feet!

I'm not sure if door templates must be placed inside the module file.

EDIT 1: How could I make a group of NPCs take one which is dead? (as in animations/scripting)

(BTW, in Firefox, I can't get the post editing to work properly, no way to use some of the stuff, like font selection and the like)

EDIT 2: I would like to know how to actually place the cut-scene in an specific room inside the module. If this must be done within the cutscene script (and spawn the objects there) or somewhere else. I suppose it will work wherever I have spawned the NPCs. I've set the Speaker/Listener tags and that stuff, as well as the model list but dunno if I'm missing something.

EDIT 3: Does ActionStartConversation need to have the NPC object (in this case it's Darth Vader) specified as first argument? The problem here is that the cut-scene runs in 262TEL, but it's actually seen when you arrive at 261TEL (the first is Echo Base, the second is Hoth module.)

Cheers.

Darth333
05-10-2006, 04:36 PM
I'm not sure if door templates must be placed inside the module file. I strongly suggest you to include them in the .mod file.

It will work in the override folder too but it will just clutter it. Also, if the filename is not unique, you will override all the other doors in the game that use the same filename. If iyour door templates are in the .mod file, it will only affect that module.

EDIT 1: How could I make a group of NPCs take one which is dead? (as in animations/scripting)
To my knowledge there is no animation for that. You can find a list of animations here (check tk102's post): http://www.lucasforums.com/showthread.php?t=164440

There is a dead animation:
AssignCommand( GetObjectByTag("my_npc_tag"), ActionPlayAnimation(ANIMATION_LOOPING_DEAD_PRONE , 1, -1)); but I've never seen any animation to carry an npc...

You will find some more sample scripts to play an animation here: http://www.lucasforums.com/showthread.php?t=162111


(BTW, in Firefox, I can't get the post editing to work properly, no way to use some of the stuff, like font selection and the like)
If the buttons don't work, you will find a list of the VB codes here: http://www.lucasforums.com/misc.php?do=bbcode


EDIT 2: I would like to know how to actually place the cut-scene in an specific room inside the module. If this must be done within the cutscene script (and spawn the objects there) or somewhere else. I suppose it will work wherever I have spawned the NPCs. I've set the Speaker/Listener tags and that stuff, as well as the model list but dunno if I'm missing something.

Just use the whereami armband to get the coordinates where you want to place the npcs. You will find some template scripts to spawn npcs, creeatures, etc. here: http://www.lucasforums.com/showthread.php?t=143536