View Single Post
Old 09-22-2011, 11:10 AM   #5
Master of Puppets
VarsityPuppet's Avatar
Join Date: May 2009
Location: MN
Posts: 1,289
Current Game: Chrono Trigger
Contest winner - Modding  Forum Veteran  Veteran Modder  Helpful! 
Here's a fun script structure I use quite often.

The Cutscene Script!

The basic premise behind it is that for dialogs and cutscenes, there are multiple nodes where things are going on. Instead of creating a script for each one of these nodes, you can use the slots in the dialog to specify a script, and then input a script parameter to choose which section to use.

void main(){

	//Declare all of your variables here. You can give them values in each separate case in the switch below

	//Each dialog node allows you to put in 5 pieces of information to deliver to the script.
	//5 integers, with which you can do whatever
	int Param1 = GetScriptParameter(1);
	int Param2 = GetScriptParameter(2);
	int Param3 = GetScriptParameter(3);
	int Param4 = GetScriptParameter(4);

	//and one String parameter, useful for putting in item templates or waypoints or whatever else
	string sParam = GetScriptStringParameter();

	//For the generic Cutscene script structure though, I just use Param1 to build each case
		case 0:
			//Code goes here
		case 1:
			//Code goes here
		case 2:
			//Code goes here
		case 3:
			//Code goes here
	} //Keep adding cases and breaks ad nauseum
That's the general structure of the Cutscene Script. Then in the dialogeditor where you want it to run, you type the script name and the case you want to run.


[a_905sleep] [1] [ ] [ ] [ ] [________]

This would run case 1 from the script above.

Hope that was helpful.

Last edited by VarsityPuppet; 09-22-2011 at 11:20 AM.
VarsityPuppet is offline   you may: quote & reply,