Mission Making Tutorial

From NexusWiki
Revision as of 23:30, 22 February 2010 by Arparso (Talk | contribs)

Jump to: navigation, search

NEXUS TJI mission-making

As you probably know by now, thanks to Arparso's great tutorial about Nexus's scripting structure, that every mission in this game is divided in MACHINES, STATES, and Rules. But that only deals with one part of the mission, the "body" of it, in a way. In order to illustrate this concepts I will be pasting here a Demo mission I've made with this article in mind.

The main parts of the mission

Here is a collection of the main parts a mission is divided into


The heading


Each mission starts, of course, with the basics of the mission: it's identity number, it's name, and where it'll take place (note that you can't change locations in a single mission):

MISSION <num>
name "<the name of the mission>" 
DefLocation "<name of the location>"

The "name of the location" is a "navpoint" created with the Solar System editor, one you can find in the "universe\systems\" folder. Unlike the number, the name of the mission doesn't have to be unique, you can put anything in there, even the same title that some other mission, as long as the numbering is not the same (well... that's not entirely true... if you place a letter instead of a number, the game will treat it as a mission number "0" and it will never give you a conflict, even if you label two or more missions as "NUMBER A"). Following that is a list of the current objective numbers, in this fashion:

OBJECTIVE
	1
	2
	...
END

Finally, as an example, here's the Demo mission's heading (note that everything after "//" and between "/* - */" is interpreted by the game as a comment):

MISSION 1  //mission number
Name "Demo Mission" //name of the mission
DefLocation "NAV_CHAKRIS_IV"  //the location where the mission will take place

OBJECTIVES //in here we place the number of objectives that will be included in the mission
	1
	2
	3
END

The SceneInit Rule


This is a very special rule, critical to any mission, and that is for the fact that this rule takes place before the mission starts. In this rule you can do pretty much anything you want, but there are a few things mandatory to do here.

  • The radius of the mission, in meters, as defined by the SetSceneRadius(<num>); command.
  • The setting of the variables associated to each of the ships that will appear on the mission (though critical for most missions, it's not mandatory), defined by the command <name of the variable> := GetSceneObj("<name of the ship>");

This rule is special also because it's the first link to any of the Machines you've written for this mission, in here you call the Machines (or Machines) you want your mission to start with. Unlike any other Rule, this one doesn't go inside a State, it only goes beneath the "RULES" block, as all the Machines in your mission do. Here's the SceneInit rule of the Demo mission, as well as the start of the "RULES" block:

RULES

	RULE 	event sceneInit
			:action
				SetSceneRadius(100000);	//this is, as the name suggests it, the radious in meters of the scene.
		
				GuiSelect(0);   //this is required to start a cinematic scene
		
				SetRelation(#race_player, #race_spacetech, 2);
				SetRelation(#race_player, #race_gorg, 2);
				SetRelation(#race_gorg, #race_player, 2);
				SetRelation(#race_spacetech, #race_player, 2);
				SetRelation(#race_player, #race_Human_E, 1);  //the relations between the races that will appear in 
                                                                              //the game. the "race_player" is the playable race, 
				                                              //and the number mean what sort of relationship they 
                                                                              //share with other races, more info on that is 
									      //located on the modding manual
				
				sp := GetSceneObj("Mayflower");
				bs := GetSceneObj("Hawkeye");   //in here we define the "Scene Objects", the ships and other
                                                                //interactive obects

				drone := GetSceneObj("Nightingale");
				
				gorg1 := GetSceneObj("Feral");
				gorg2 := GetSceneObj("Darkclaw");
				
				Disappear(drone);
				Disappear(gorg1);
				Disappear(gorg2); //we disappear the ships that are bound to appear via ip drive
				
				Playmusic(1);          //in here we set the number of the music track (as defined in the
                                                       //mod_sound.ini file, in the universe\engine\ folder
				
				GetMachine("Director"):ChangeState(IntroMovie, 0);
				GetMachine("Objectives"):ChangeState(monitor,0);    // with these commands we "call" the machines 
                                                                                    //that would define the game, and their given
                                                                                    // state
				
				FadeScreen(1, 0, 0);                       //we "fade" the screen, make it black
			:end
	END

The body of the mission

--- The sintax of this part has already been brilliantly explained by Arparso in his Tutorial, so I will only offer some advices here. Always use different states when there's a remarkable change in the mission (arrival of ships, discovery of stuff, etc), and try to keep your mission as tidy as possible. Machines can run simultaneously, so having a lot of them is never a good idea. Try to divide them into clear, differenced tasks (one of the AI, one or two for the actual mission, etc). So, here's the body of the Demo mission: body Also, don't forget that once you've finished with all your machines, included all the files that you wanted to include (to include a file you have to do this: "#include "<name of the file" ", and it would be like you wrote the content of that file in the mission file, so keep a close watch on the mission syntax when including files!) you have to END the mission. Just add a final END on the bottom, after the last included file and just above the ENTITIES section.

The ENTITIES section

--- Here's defined the settings of each of the mission's ships, like name, class, race, location, heading, etc, in this fashion:

SHIP
	<content>
END

Whereas the content may be:

  • Name "<name of the ship>"
  • Race #<race of the ship>
  • ShipType #<ship type of the ship, as defined in the SHIPTYPE part of the tacticstypes.ini>

or

  • Class #<class of the ship, as defined in the SHIPCLASS part of the tacticstypes.ini>
  • Position <x y z coordinates of the ship>
  • Orientation <pitch heading and bank of the ship>
  • Devices #<dev 1> #<dev 2> ... #<dev n> ; Note that this is optional, every device you place here will be added to the ship, so BE CAREFUL with it.

You may also add NPC's here to the mission's ships:

NPC
	<content>
END

with the content being:

  • Name "<name>"
  • ID <num> The id is the way to link this NPC to each dialog
  • Face <num> If this line is not provided, then the game will use the ID number as face number
  • Rank <num 1-10>
  • Medals #<medal 1> ... #<medal n> ;
  • CrewLevel <num> The level of the crew
  • Skill 1 <num> The skill of this npc in the Military area
  • Skill 2 <num> idem but in the engineering area
  • Skill 3 <num> idem but in the scientific area
  • XP <num> The experience of this npc.

That pretty much covers it. Here's Demo mission's ENTITIES area:

ENTITIES

	SHIP
		Name "Hawkeye"
		Race #race_Player
		ShipType #styp_ep6_Siege_Battleship
		Position -1000 838 -8966
		Orientation 0 0 0

		NPC
			Name "Johan Mastropiero"

			ID 1
			Face 20
			Rank 3
			Medals ;
			CrewLevel 1
			Skill 1 0
			Skill 2 0
			Skill 3 0
			XP 0
		END
	END

	SHIP
		Name "Nightingale"
		Race #race_SpaceTech
		ShipType #styp_Frigate
		Position 2441.14 -8877.7 2618.99
		Orientation 180 0 0
	END

	SHIP
		Name "Mayflower"
		Race #race_Human_E
		ShipType #styp_Supportship
		Position -12843.8 -1399.87 -5833.99
		Orientation 0 0 0

		NPC
			Name "James Carson"

			ID 2
			Face 26
			Rank 2
			Medals ;
			CrewLevel 1
			Skill 1 0
			Skill 2 0
			Skill 3 0
			XP 0
		END
	END

	SHIP
		Name "Feral"
		TechCat 31 20
		TechPointsScanned 0
		Race #race_Gorg
		ShipType #styp_ep6_gorg_escortcruiser
		Position -5890.52 -22.7949 7108.39
		Orientation -92.7069 -36.0036 47.6695
	END

	SHIP
		Name "Darkclaw"
		TechCat 31 30
		TechPointsScanned 0
		Race #race_Gorg
		ShipType #styp_ep3_gorg_heavy_battleship
		Position -5892.08 769.904 6509.39
		Orientation -92.7069 -36.0036 47.6695
	END

END

Auxiliary parts of a mission

--- I'll now move to explain two other files linked to every mission. Although they're not critical to a mission, they're advised to be included, as they're the files that contain the dialogs and objectives.

Dialogs

--- The dialogs of each mission go into a file (any file, as long as it is a .ini file. Moreover, two or more mission's dialogs could go into one or more files, although that's not encouraged. Best to keep things nice and tidy) in the \universe\texts\dialogs\ folder. The dialog syntax is as follows:

Dialog
	<content>
END 

with the content being:

  • name <identifier number of the dialog, the one that links the dialog to the mission>
  • Layout <where it's located on the screen, see the manual>
  • NPC <id number of the npc saying this>
  • distort <num ranging from -1 to 3> it's the level of interference in a dialog (with -1 being none whatsoever)
  • ExpireEvent <event to occur when the dialog ends (in the same state where the dialog was called, of course)>

Here is the text build of each dialog:

	
	text
	{
				<language (0 for English, 2 for Spanish, 1 for Hungarian...)> "<content>"
	}

Here are the dialogs corresponding to the Demo mission: Dialogs


in case of being this a dialog with a choice system built-in, a few things are added:

  • ChooseTime <num in seconds> the amount of time the dialog stays on the air by itself

and the text build will look something like this:

	text
	{
		<language1> "<text in language 1>"
		<language2> "<in language 2>"
		.........
	}
	options
		{
			<language1> "<1° choice in language 1>"
			<language2> "<in language 2>"

			.........	
		}
		<event generated by choice 1>
		{
			<language1> "<2° choice in language 1>"
			<language2> "<in language 2>"

			.........
		}
		<event generated by choice 2>

		............

		{
			<language1> "<n� choice in language 1>"
			<language2> "<in language 2>"

			.........
		}
		<event generated by choice n>
	END

unfortunately, there aren't any dialogs with such choices in the Demo mission, but I can provid you with an example, taken from my mission "Consequences" available in the Stargate Mod: War Begins PB4, 5, 6 and 7 (at the time this article was written):

DIALOG
	name dialog_consequences_c2_4
	Layout 6
	ExpireEvent TimerFail
	NPC 9
	distort -1
	text
	{
            	0 "They aren't responding sir, and they are charging weapons. What do we do sir? Fight or flee?"
	}
        options
      {
         0 "We fight. All hands to battle stations!" 
      }
      Fight

      {
         0 "We came here to fight the replicators, no the Lucians. Major, get us out of here."
      }
      Flee

     END  //we end the choices
END

Objectives

--- The Objectives of a mission go into any file (in pretty much the same way that the dialogs) in the \universe\texts\mod_texts\ or in the \universe\texts\texts\ folders. Each dialog is linked to a mission with the mission's number, in this fashion:

TEXT "objective_<num of mission>_<numv of objective>"
	<language> "<text in that language>"
END

And that's pretty much it. The Demo Mission's objectives are located here