Add From Template

Here are the script templates you can add by right clicking in the Scripts window and choosing "Add From Template." I found it nice to have them available outside of the Toolset for ease of reference.

I'll be adding the rest later.

Conversation Switch

Use this template when you are creating a script that will control actions during a conversation. Pass the variable nAction from the conversation to tell the script which case you want to perform. For instance, pass 100 as the nAction argument to execute the code for case 100.

If you need more information on what a case statement is, see the Wikipedia entry on case statements.

A common way to control the action in conversation switches is with ActionPauseCutscene() and AssignCutsceneActionToObject(). A cut scene action is an action that has a special flag that tells the pause function to resume once the action has been complete. An example from the OC would is:

ActionPauseCutscene(1000, FALSE);
AssignCutsceneActionToObject(oRegulator, ActionWait(1.0f));

This example uses a regulator because the example it comes from (a romance script in module 3500) needed to keep both speakers available for other actions. For best results, a regulator is an Ipoint speaker, which can be found under Blueprints > Placeables > Misc Props. I found that removing the heartbeat from the Ipoint and also using it as the speaker is a good way to make sure that you don't run into conflicting action assignments.

Once you have the pauses set and you static cameras place on your converations nodes, you can add custom functions in the case that will control the movement of other characters. For instance, in the following example you can see that there are a number of custom functions that are included in the file that get referenced.

		case 6:
			ActionPauseCutscene(15000, FALSE);
			AssignCutsceneActionToObject(oRegulator, ActionWait(15.0f));
			MoveCameraman1Again();
			PlayRomanceStinger();
			MovePC();
			DelayCommand(11.0f, FadeOut());
			break;	

and further down:

void MoveCameraman1Again()
{
	object oCameraman = GetTarget("3501_cameraman1");
	object oWP = GetTarget("3501_wp_camerman2");
	
	AssignCommand(oCameraman, ClearAllActions(TRUE));
	DelayCommand(1.0f, AssignCommand(oCameraman, ActionForceMoveToObject(oWP, FALSE)));
}

Note that I usually use GetNearestObjectByTag instead of GetTarget, but that's just because I'm not sure what GetTarget really does.

Obviously you can go pretty crazy with this. Here is the base code from the template for reference:

// 
/*
    master script for conversation X
*/
// 

#include "ginc_actions"


void main(int nAction)
{
    object oPC = GetPCSpeaker();

    switch ( nAction )
    {

        case 100:	//
			break;

        case 200:	//
			break;

        case 300:	//
			break;

        case 400:	//
			break;

        case 500:	//
			break;
    }

}

Area OnClientEnter Cutscene

The onClientEnter cut scene script is a great way to start a cut scene conversation. Create either an Ipoint with a new tag or use a creature as the main speaker. Also create a conversation. Then plug these two into number three (below).

The condition to play and the additional cutscene scripting are great places to use variables, either on the module or campaign level, to control whether the cut scene should fire. For instance, if you set a quest tracking variable called "sidequest2" to be 10 when the party got the quest, and you wanted to test for condition sidequest2 == 10, you'd place that in step two below. Then in the additional cut scene scripting you'd update the quest tracking variable to 20 so that the game knew not to play this cutscene again.

// Area OnClientEnter Cutscene.nss
/*
	Area OnClientEnter event handler template. Setup cutscene(s) to fire when the party enters a new area.
	This script will execute after a group area transition using JumpPartyToArea().
	bCutsceneCondition will determine if a cutscene should play, but each cutscene is restricted to play only once.
	
	HOW TO SETUP A CUTSCENE:
		0. Copy and paste script block into "CLIENT ENTER CUTSCENES"
		1. Specify a title for your cutscene
		2. Replace (FALSE) with condition to play cutscene
		3. Specify Speaker and Dialog of conversation
		4. Add additional cutscene scripting
	
		// Cutscene: 1. Example Title
		if (GetIsCutscenePending(stCI) == FALSE)
		{
			bCutsceneCondition = (FALSE);	// 2. Replace (FALSE) with condition to play
			sSpeakerTag = "";				// 3. Specify Speaker and Dialog
			sDialogName = "";

			stCI = SetupCutsceneInfo(stCI, sSpeakerTag, oPC, sDialogName, bCutsceneCondition);	

			if (GetIsCutscenePending(stCI) == TRUE)	
			{
				// 4. Additional cutscene setup
			}
		}
*/
// BMA-OEI 2/3/06
// BMA-OEI 2/7/06 added speaker == PC check
// ChazM 2/7/06 modified implementation
// ChazM 2/7/06 moved funcs to ginc_cutscene
// BMA-OEI 2/7/06 support multiple cutscenes
// BMA-OEI 2/7/06 revert original controlled char
// BMA-OEI 2/8/06 added comments, Group Area Transition restriction

#include "ginc_cutscene"

int StartingConditional()
{
	// Do not execute if OnClientEnter was not fired from a group area transition
	if (FiredFromPartyTransition() == FALSE) return (FALSE);

	// Get party leader, force control of owned PC
	object oPC = GetFirstEnteringPC();
	object oLeader = GetFactionLeader(oPC);
	oPC = SetOwnersControlledCompanion(oLeader);

	// Initialize temp CutsceneInfo
	struct CutsceneInfo stCI;
	stCI = ResetCutsceneInfo(stCI);
	int bCutsceneCondition;
	string sSpeakerTag;
	string sDialogName;

	// *** START CLIENT ENTER CUTSCENES ***

		// Cutscene: 1. Example Title
		if (GetIsCutscenePending(stCI) == FALSE)
		{
			bCutsceneCondition = (FALSE);	// 2. Replace (FALSE) with condition to play
			sSpeakerTag = "";				// 3. Specify Speaker and Dialog
			sDialogName = "";
	
			stCI = SetupCutsceneInfo(stCI, sSpeakerTag, oPC, sDialogName, bCutsceneCondition);	
	
			if (GetIsCutscenePending(stCI) == TRUE)	
			{
				// 4. Additional cutscene setup
			}
		}
	
	// *** END CLIENT ENTER CUTSCENES ***

	// Cue cutscene or revert control to original character
	if (GetIsCutscenePending(stCI) == TRUE)
	{	
		FireAndForgetConversation(stCI.oSpeaker, oPC, stCI.sDialog);
	}	
	else
	{
		SetOwnersControlledCompanion(oPC, oLeader);
	}

	// If cutscene is pending, fade to black
	return GetIsCutscenePending(stCI);
}