Print

CONTENTS:

A. Foreword

Mission scripting can be an irritating but rewarding process. There is nothing like making a mission you always wanted to play come true before your eyes! Well, ok, there are some things, but I'm not going to list them here. Lets get to the point and script a mission shall we?

The lines that you need to add are colour coded red.

B. Before you begin

Basically all you need to make a mission is Notepad, but since I-War is very sensitive about typos I recommend a program that checks your spelling. Before you begin scripting you should also have done the following: deslab all slb files and get the scripting reference guide from PS's website.

I-War mission scripts are like a computer program. If you have some programming experience, then scripting a mission will be simple. If you have never programmed, no problem. All it takes is a little bit of abilities to think logically. A mission script execution will start from the first line and all commands will be executed (near) instantaneously until there is command to wait.

C. Regloads and startup commands

Lets take a look at the mission_template.scr file. You can find it in the psg/resource/scripts/missions directory under you I-War path. This is where we shall start. Notice the lines that begin with ; . They are commented lines, which means I-War will totally ignore them. They are a good way to place descriptions of variables or descriptions of how a certain part of the script works. These will make it easier for you and others to debug and add things to the mission.

The very first commands on the mission template is:

SCENEITEM Dreadnt,Destroyer,Puf1,Puf2,Puf3,Puf4,Pat1,Pat2

It describes what sceneitem are used in the mission. Sceneitem can be a ship, an asteroid or some other thing you may interact with. Now ignore this line. Yes, ignore it - its totally useless. I have never used it and I never will. Mission will run just fine without first declaring sceneitems.

Same goes with MODEL and RESOURCE commands.

VAR temp

command means that a variable called 'temp' will be used in the mission. Ignore this for now.

Next comes the Resources bit. This is important. In the beginning of each mission, you must load all models that will be used in the mission. Models are the various ships, stations and rocks that hang around the space looking good. The first REGLOAD command is the following:

REGLOAD DreadMd,"\psg\resource\shapes\CorvAsm_rto.lwo",LWO2BRM

This means that I-War will load the file CorvAsm_rto.lwo from the \psg\resource\shapes\ directory under your I-War path. In the script, the file will be referred to as DreadMd. The LWO2BRM is just an extension that must be used with all the model REGLOADs, just add the extension every time and you'll do fine.

The CorvAsm_rto.lwo file in particular is the model of a dreadnaught class corvette. The same ship the player is flying in the game. The other regload are:

REGLOAD CommandMd,"\psg\resource\shapes\Command_RTO.lwo",LWO2BRM
REGLOAD CruiserMd,"\psg\resource\shapes\Cruiser_RTO.lwo",LWO2BRM
REGLOAD FighterMd,"\psg\resource\shapes\PuffinPilot.lwo",LWO2BRM
REGLOAD HangerMd,"\psg\resource\shapes\hanger_rto.lwo",LWO2BRM
REGLOAD PatMd,"\psg\resource\shapes\PatCom_RTO.lwo",LWO2BRM
REGLOAD PufMd,"\psg\resource\shapes\Puffin_rto.lwo",LWO2BRM

From top to bottom: command module, cruiser, puffinpilot (a model of a miniature corvette with a human figure sitting on it - further proof of PS's twisted sense of humor.), a space station model (an STC to be more precise), a patcom and a puffin class tug. For now, these models will be enough for us so there is no need to edit the list in any way.

After the REGLOADs the player's ship is created and defined. We'll get to the details of creating ship later, but to summarise the CREATE_SHIP line and the following line create a dreadnaught class corvette called 'Dreadn'. Its name in the script, that is. Its name in the game is: Dreadnaught CNV-301. To define a ship as the player's ship the PLAYER command is used in following line.

PLAYER Dreadnt

Means that the ship called 'Dreadnt' is now the player's ship. Note that the player ship doesn't have to be a Dreadnaught class corvette, but since the interface is designed for the Dreadnaught, the cockpit will look the same.

The command after the PLAYER command is:

LAGRANGE,LP4,"L4",0,0,0

This makes a lagrange point. Just ignore it for now. Also ignore the following lines:


CAMERA CamWep,CAM_CHASE,Dreadnt,0,0,-20000
CAMERA CamPly,CAM_PLAYER,Dreadnt,0,0,-20000

#INCLUDE test0_x.gui
REGLOAD SphMd,"\psg\resource\shapes\mikenebfrc.lwo",LWO2BRM

These are unimportant. Next comes the line that says:

STARFIELD 1200,ON,13

This makes a starfield with 1200 stars, sets the nebula on (a nebula will be displayed) and makes the nebula that looks blue-purple. If there is a number at the end, then a nebula will be added. Since we are going to use the default game nebulae we wont be needing another nebula. Delete the number 13:

STARFIELD 1200,ON

You can run the mission if you like. You'll notice that you are in a dreadnaught that is next to a lagrange point called L4.

Now. Lets start editing this. Notice the commented-out line above the REGLOADs that says GENESIS. The GENESIS command creates the universe. Stars, planets, moons and lagrange points. Lets do that.

Add the line:

GENESIS

just under the line that says ";--- Player and initial setups ------------------". Since the default univese already has lagrange points we don't need any more of those. Delete the line that created the lagrange point. Now notice the commented out line that says:

; SYSTEM "Sol","L4"

This sets the system we are in. Uncomment it by removing the ; and edit it so that it says.

SYSTEM "8","L5"

This places us into the Delta Pavonis system L5 point. There is a complete list of system number at the end of the scripting reference guide.

Your mission script should now look like this:

;----------------------------------------------
;	Mission template.
;----------------------------------------------

;--- Declarations -----------------------------

SCENEITEM	Dreadnt,Destroyer,Puf1,Puf2,Puf3,Puf4,Pat1,Pat2

MODEL		DreadMd,SphMd,PufMd,FightMd,DestroyerMd,GunStarMd,BombMd,NAVYBaseMd,PatComMd
MODEL		IPufMd,IPatComMd

RESOURCE	Txt1,Txt2,Txt3,Txt4,Txt6,Txt8,Txt9,Txt10,Txt11,TWin,TLose

SCENEITEM	LP4,WP0,WP1,WP2

VAR			Temp

;		GENESIS

;--- Resources ----------------------------------

		REGLOAD	DreadMd,"\psg\resource\shapes\CorvAsm_rto.lwo",LWO2BRM
		REGLOAD	CommandMd,"\psg\resource\shapes\Command_RTO.lwo",LWO2BRM
		REGLOAD CruiserMd,"\psg\resource\shapes\Cruiser_RTO.lwo",LWO2BRM
		REGLOAD FighterMd,"\psg\resource\shapes\PuffinPilot.lwo",LWO2BRM
		REGLOAD	HangerMd,"\psg\resource\shapes\hanger_rto.lwo",LWO2BRM
		REGLOAD PatMd,"\psg\resource\shapes\PatCom_RTO.lwo",LWO2BRM
		REGLOAD	PufMd,"\psg\resource\shapes\Puffin_rto.lwo",LWO2BRM

;--- Load text -------------------

;--- Player and initial setups ------------------

		GENESIS

		CREATE_SHIP Dreadnt,DreadMd,"Dreadnaught CNV-301",CORVETTE,NAVY,0,0,0,-180,0,0
#INCLUDE pcorvette.shp
		PLAYER	Dreadnt

		SYSTEM "8","L5"


;------------------------------------------------

		CAMERA	CamWep,CAM_CHASE,Dreadnt,0,0,-20000
		CAMERA	CamPly,CAM_PLAYER,Dreadnt,0,0,-20000

#INCLUDE test0_x.gui
		REGLOAD	SphMd,"\psg\resource\shapes\mikenebfrc.lwo",LWO2BRM

		STARFIELD	1200,ON

;------------------------------------------------

;------------Routines-------------------
		
End:
		END

You can run the mission now, if you like. Next we shall create some ships!

D. Creating ships

For clarity's sake, add a line just under the lines that created the Dreadnaught that says:

;Mission script begins:

Now, lets create a space station nearby.

CREATE_SHIP STC,HangerMd,"Pavonis L5 STC",STATION,NAVY,500000,0,500000,-180,0,0
#INCLUDE stc.shp

CREATE_SHIP command creates ships and other objects. After the command itself you must define it's name, the model to use, the name showed to you when playing, it's type, it's allegiance, its x, y and z coordinates, and its angle with x, y and z axis.

To summarise what we just did: We created a ship which is referred to as STC. It uses the HangerMd model that was REGLOADed earlier (the one that looked like an STC), when you target it in the game it says Pavonis L5 STC in the target info screen. It is designated as a commonwealth navy station and is 5 kilometers along the x axis and 5 kilometers along the y axis. Note that the I-War coordinate system uses centimeters so to get the location in meters you'll have to add two more zeros.

The line after the CREATE_SHIP command says:

#INCLUDE armedstc.shp

This means that a ship file will be included at this point. A ship file is a file that describes a ship's (or station's) engines, weapons, engine lights, hull strengths and other cool things. Without any description of these things, the station would appear to be about as strong as an asteroid and wouldn't have any weapons at all. To see what ship files are available, look into the psg/resource/scripts/ships folder. The ship file we included has a setup for a generic STC station that is armed.

We want the dreadnaugt to be docked with the STC in the beginning of the mission, so we'll do just that. Add the line:

DOCK Dreadnt,STC,1,0

This docks Dreadnt to STC so that Dreadnt docking port number 1 is connected to STC's docking port number zero. NOTE: To dock objects together they both must have at least a one free (=undocked) docking port. If they don't have one, nothing happens.

Your mission script should now look like this:

;----------------------------------------------
;	Mission template.
;----------------------------------------------

;--- Declarations -----------------------------

SCENEITEM	Dreadnt,Destroyer,Puf1,Puf2,Puf3,Puf4,Pat1,Pat2

MODEL		DreadMd,SphMd,PufMd,FightMd,DestroyerMd,GunStarMd,BombMd,NAVYBaseMd,PatComMd
MODEL		IPufMd,IPatComMd

RESOURCE	Txt1,Txt2,Txt3,Txt4,Txt6,Txt8,Txt9,Txt10,Txt11,TWin,TLose

SCENEITEM	LP4,WP0,WP1,WP2

VAR			Temp

;		GENESIS

;--- Resources ----------------------------------

		REGLOAD	DreadMd,"\psg\resource\shapes\CorvAsm_rto.lwo",LWO2BRM
		REGLOAD	CommandMd,"\psg\resource\shapes\Command_RTO.lwo",LWO2BRM
		REGLOAD CruiserMd,"\psg\resource\shapes\Cruiser_RTO.lwo",LWO2BRM
		REGLOAD FighterMd,"\psg\resource\shapes\PuffinPilot.lwo",LWO2BRM
		REGLOAD	HangerMd,"\psg\resource\shapes\hanger_rto.lwo",LWO2BRM
		REGLOAD PatMd,"\psg\resource\shapes\PatCom_RTO.lwo",LWO2BRM
		REGLOAD	PufMd,"\psg\resource\shapes\Puffin_rto.lwo",LWO2BRM

;--- Load text -------------------

;--- Player and initial setups ------------------

		GENESIS

		CREATE_SHIP Dreadnt,DreadMd,"Dreadnaught CNV-301",CORVETTE,NAVY,0,0,0,-180,0,0
#INCLUDE pcorvette.shp
		PLAYER	Dreadnt

		SYSTEM "8","L5"


;------------------------------------------------

		CAMERA	CamWep,CAM_CHASE,Dreadnt,0,0,-20000
		CAMERA	CamPly,CAM_PLAYER,Dreadnt,0,0,-20000

#INCLUDE test0_x.gui
		REGLOAD	SphMd,"\psg\resource\shapes\mikenebfrc.lwo",LWO2BRM

		STARFIELD	1200,ON

;-------------------------------------
;Mission script begins:


		CREATE_SHIP STC,HangerMd,"Pavonis L5 STC",STATION,NAVY,1000000,0,1000000,-180,0,0
#INCLUDE armedstc.shp

		DOCK	Dreadnt,STC,1,0


;------------Routines-------------------
		
End:
		END

You can run the mission now. You'll notice that there is a navy STC near the L-point and that your ship is docked to it.

E. Basic waits, getting around and waypoints

Next we want to fly around a bit. We'll add the line:

SET_TARG_LP 7,"L5"

This makes the ships navigator to select system number 7 L-point "L5" as your jump destination. Once the player's ship passes through a lagrange point, it will jump to that system. System number 7 is Metallake.

Since I-War executes all commands instantly until it encouter a wait command, we will have to add one now, or anything we want to happen later in the mission will happen instantly from the start. Thats why we add the following line:

WAIT_UNTIL INSYSTEM,7

This will wait until the player is in system number 7.

This mission will be a patrol, so we will add some waypoints once we arrive to the system. Add the line:

WAYPT Waypoint1,"Patrol Area",5000000,300000,100000

This will create a waypoint quite far from the L-point. The waypoint will be referred to as Waypoint1 and it's name in the game will be 'Patrol Area'. Note that the coordinates for waypoint are given in kilometres.

Lets make a little indie trap in the patrol area. First we'll have to wait until the player reaches the waypoint, or is at least relatively close to it. Add the line:

WAIT_UNTIL NEARTO,Dreadnt,Waypoint1,1000000

This waits until the Dreadnaught is 10 km from Waypoint1 and then continues executing the mission script.

We wanted an indie trap in the patrol area. Lets say the indies are trying to lure a navy ship into an ambush by using a fake distress call. (Yes, the oldest trick in the book!) We'll create a neutral tug:

RELATIVE Waypoint1

CREATE_SHIP Puffin,PufMd,"Tug T-4601",TUG,NEUTRAL,0,0,3000000,-180,0,0
#INCLUDE puffin.shp

Notice the RELATIVE command. It sets the coordinate origo (point 0,0,0) to the designated ship or other object. In our case Waypoint1. Now the newly created the tug will show up 30 km from Waypoint1 instead of the lagrange point. All following objects will also appear relative to Waypoint1 unless we add a new RELATIVE command.

Since the indies are sneaky, they made it look good. We want the puffin to look like it was disable and drifting - a ship in distress. We'll add the lines:

ORDER 1,0,LASTSHIP,"Drift",0,0,40,40,0

and

ROT LASTSHIP,0,0,0,4,7,3

VEL LASTSHIP,20,44,23

The ORDER command gives the ship an order called Drift. This will do exactly as it implies. The ship will drift without using its engines. The first number is the number of the order. Each ship can have multiple orders. The first number 40 is the order priority. The more important the order, the more the ship will want to execute that. In our case, the ship only has one order so this is unimportant. You can ignore the rest of the numbers for now.

ROT command rotates the designated ship. The first three numbers are the initial alignment (x, y, z) and the next three numbers are the angular velocities around x, y or z axis.

VEL command gives the ship some velocity - again along x,y and z axis.

LASTSHIP refers to the last ship to be edited. Its a very useful variable that can save you from a lot of typing. Just make sure that the last ship actually is the ship you want to tinker with.

Since the indies are broadcasting a fake distress call lets make the ship really visible. Add the following:

WAYPT Waypoint2,"Distress Call",0,0,0
ATTACH_WAYPT Waypoint2,Puffin

This makes another waypoint that shows up as 'Distress Call'. It will be referred to as Waypoint2. After creating it we will also put it to the right place. The ATTACH_WAYPT command attaches a waypoint to an object. The waypoint will then follow the object anywhere it goes.

We have added quite a bit. Your script should now look like this:

;----------------------------------------------
;	Mission template.
;----------------------------------------------

;--- Declarations -----------------------------

SCENEITEM	Dreadnt,Destroyer,Puf1,Puf2,Puf3,Puf4,Pat1,Pat2

MODEL		DreadMd,SphMd,PufMd,FightMd,DestroyerMd,GunStarMd,BombMd,NAVYBaseMd,PatComMd
MODEL		IPufMd,IPatComMd

RESOURCE	Txt1,Txt2,Txt3,Txt4,Txt6,Txt8,Txt9,Txt10,Txt11,TWin,TLose

SCENEITEM	LP4,WP0,WP1,WP2

VAR			Temp

;		GENESIS

;--- Resources ----------------------------------

		REGLOAD	DreadMd,"\psg\resource\shapes\CorvAsm_rto.lwo",LWO2BRM
		REGLOAD	CommandMd,"\psg\resource\shapes\Command_RTO.lwo",LWO2BRM
		REGLOAD CruiserMd,"\psg\resource\shapes\Cruiser_RTO.lwo",LWO2BRM
		REGLOAD FighterMd,"\psg\resource\shapes\PuffinPilot.lwo",LWO2BRM
		REGLOAD	HangerMd,"\psg\resource\shapes\hanger_rto.lwo",LWO2BRM
		REGLOAD PatMd,"\psg\resource\shapes\PatCom_RTO.lwo",LWO2BRM
		REGLOAD	PufMd,"\psg\resource\shapes\Puffin_rto.lwo",LWO2BRM

;--- Load text -------------------

;--- Player and initial setups ------------------

		GENESIS

		CREATE_SHIP Dreadnt,DreadMd,"Dreadnaught CNV-301",CORVETTE,NAVY,0,0,0,-180,0,0
#INCLUDE pcorvette.shp
		PLAYER	Dreadnt

		SYSTEM "8","L5"


;------------------------------------------------

		CAMERA	CamWep,CAM_CHASE,Dreadnt,0,0,-20000
		CAMERA	CamPly,CAM_PLAYER,Dreadnt,0,0,-20000

#INCLUDE test0_x.gui
		REGLOAD	SphMd,"\psg\resource\shapes\mikenebfrc.lwo",LWO2BRM

		STARFIELD	1200,ON

;-------------------------------------
;Mission script begins:


		CREATE_SHIP STC,HangerMd,"Pavonis L5 STC",STATION,NAVY,1000000,0,1000000,-180,0,0
#INCLUDE armedstc.shp

		DOCK	Dreadnt,STC,1,0

		SET_TARG_LP 7,"L4"

		WAIT_UNTIL	INSYSTEM,7

		WAYPT	 Waypoint1,"Patrol Area",5000000,300000,100000

		WAIT_UNTIL	NEARTO,Dreadnt,Waypoint1,1000000

		RELATIVE	Waypoint1

		CREATE_SHIP Puffin,PufMd,"Tug T-4601",TUG,NEUTRAL,0,0,3000000,-180,0,0
#INCLUDE puffin.shp

		ORDER 1,0,LASTSHIP,"Drift",0,0,40,40,0

		ROT LASTSHIP,0,0,0,4,7,3
		VEL LASTSHIP,20,44,23

		WAYPT	Waypoint2,"Distress Call",0,0,0
		ATTACH_WAYPT	Waypoint2,Puffin

		RELATIVE	

		CREATE_SHIP Patcom1,IndiePatMd,"Dancing Devil",PATCOM,INDIE,

;------------Routines-------------------
		
End:
		END

You may want to try the mission now.

F. Combat, indie textures and other tricks

The indies were going to ambush the navy so we need to add the ambush squad. Lets say two indie patcoms. Wait! We don't have an indie patcom REGLOAD'ed. We have a regular patcom, but it will look just like a navy patcom. We want one with an indie paint job - after all, no self respecting indie flies a ship without a paint job. Add the following three lines to the REGLOADs at the beginning of the script:

LOADMAP "INDEX_TOP","\psg\resource\art\textures\indieships\PCT_Skul.pix"
LOADMAP "INDEX_BOT","\psg\resource\art\textures\indieships\PCB_Skul.pix"
REGLOAD IndiePatMd,"\psg\resource\shapes\PatComI_rto.lwo",LWO2BRM

We now have an indie patcom model loaded. The model will be called IndiePatMd. The LOADMAP command changes the texture maps for the ship model that follows. Now lets add the indie force near the puffin.

RELATIVE Puffin

CREATE_SHIP Patcom1,IndiePatMd,"Dancing Devil",PATCOM,INDIE,700000,500000,0,-90,0,0
#INCLUDE patcom.shp

CREATE_SHIP Patcom2,IndiePatMd,"Uncle Jack",PATCOM,INDIE,-700000,500000,0,90,0,0
#INCLUDE patcom.shp

If you try the mission, you will notice that the patcoms are too visible. Since they show up on sensors, this ambush is doomed to fail. Lets add some more commands:

NOCONTACT Patcom1,ON
NOCONTACT Patcom2,ON

The NOCONTACT command makes ships invisible on sensors. This simulates stealth ships or, in our case, a ship that is powered down so that there is no thermal trace. Now the ships won't show up on sensors. Next we wait until the navy ship gets closer...

WAIT_UNTIL NEARTO,Dreadnt,Puffin,400000

When its 4 km away, the indies power up the patcoms and attack!

ORDER 1,0,Patcom1,"FixedAttack",0,0,40,40,0
ORDER 1,0,Patcom2,"FixedAttack",0,0,40,40,0
ORDER 1,0,Puffin,"FixedAttack",0,0,40,40,0

The FixedAttack order is a multipurpose attack order, that makes the ship attack any ships that are of hostile alignment. We now have the ships attacking, but the Patcoms are still invisible on sensors. They aren't stealth so we'll change that. We'll also change the alignment of Puffin so that it shows up as an indie.

NOCONTACT Patcom1,OFF
NOCONTACT Patcom2,OFF
NEW_ALLEG Puffin,INDIE

All right! Your mission script should now look like this:

;----------------------------------------------
;	Mission template.
;----------------------------------------------

;--- Declarations -----------------------------

SCENEITEM	Dreadnt,Destroyer,Puf1,Puf2,Puf3,Puf4,Pat1,Pat2

MODEL		DreadMd,SphMd,PufMd,FightMd,DestroyerMd,GunStarMd,BombMd,NAVYBaseMd,PatComMd
MODEL		IPufMd,IPatComMd

RESOURCE	Txt1,Txt2,Txt3,Txt4,Txt6,Txt8,Txt9,Txt10,Txt11,TWin,TLose

SCENEITEM	LP4,WP0,WP1,WP2

VAR			Temp

;		GENESIS

;--- Resources ----------------------------------

		REGLOAD	DreadMd,"\psg\resource\shapes\CorvAsm_rto.lwo",LWO2BRM
		REGLOAD	CommandMd,"\psg\resource\shapes\Command_RTO.lwo",LWO2BRM
		REGLOAD CruiserMd,"\psg\resource\shapes\Cruiser_RTO.lwo",LWO2BRM
		REGLOAD FighterMd,"\psg\resource\shapes\PuffinPilot.lwo",LWO2BRM
		REGLOAD	HangerMd,"\psg\resource\shapes\hanger_rto.lwo",LWO2BRM
		REGLOAD PatMd,"\psg\resource\shapes\PatCom_RTO.lwo",LWO2BRM
		REGLOAD	PufMd,"\psg\resource\shapes\Puffin_rto.lwo",LWO2BRM

		LOADMAP "INDEX_TOP","\psg\resource\art\textures\indieships\PCT_Skul.pix"
		LOADMAP "INDEX_BOT","\psg\resource\art\textures\indieships\PCB_Skul.pix"
		REGLOAD	IndiePatMd,"\psg\resource\shapes\PatComI_rto.lwo",LWO2BRM

;--- Load text -------------------

;--- Player and initial setups ------------------

		GENESIS

		CREATE_SHIP Dreadnt,DreadMd,"Dreadnaught CNV-301",CORVETTE,NAVY,0,0,0,-180,0,0
#INCLUDE pcorvette.shp
		PLAYER	Dreadnt

		SYSTEM "8","L5"


;------------------------------------------------

		CAMERA	CamWep,CAM_CHASE,Dreadnt,0,0,-20000
		CAMERA	CamPly,CAM_PLAYER,Dreadnt,0,0,-20000

#INCLUDE test0_x.gui
		REGLOAD	SphMd,"\psg\resource\shapes\mikenebfrc.lwo",LWO2BRM

		STARFIELD	1200,ON

;-------------------------------------
;Mission script begins:


		CREATE_SHIP STC,HangerMd,"Pavonis L5 STC",STATION,NAVY,1000000,0,1000000,-180,0,0
#INCLUDE armedstc.shp

		DOCK	Dreadnt,STC,1,0

		SET_TARG_LP 7,"L4"

		WAIT_UNTIL	INSYSTEM,7

		WAYPT	 Waypoint1,"Patrol Area",5000000,300000,100000

		WAIT_UNTIL	NEARTO,Dreadnt,Waypoint1,1000000

		RELATIVE	Waypoint1

		CREATE_SHIP Puffin,PufMd,"Tug T-4601",TUG,NEUTRAL,0,0,3000000,-180,0,0
#INCLUDE puffin.shp

		ORDER 1,0,LASTSHIP,"Drift",0,0,40,40,0

		ROT LASTSHIP,0,0,0,4,7,3
		VEL LASTSHIP,20,44,23

		WAYPT	Waypoint2,"Distress Call",0,0,0
		ATTACH_WAYPT	Waypoint2,Puffin

		RELATIVE	Puffin

		CREATE_SHIP Patcom1,IndiePatMd,"Dancing Devil",PATCOM,INDIE,700000,500000,0,-90,0,0
#INCLUDE patcom.shp

		CREATE_SHIP Patcom2,IndiePatMd,"Uncle Jack",PATCOM,INDIE,-700000,500000,0,90,0,0
#INCLUDE patcom.shp

		NOCONTACT	Patcom1,ON
		NOCONTACT	Patcom2,ON

		WAIT_UNTIL	NEARTO,Dreadnt,Puffin,400000

		ORDER		1,0,Patcom1,"FixedAttack",0,0,40,40,0
		ORDER		1,0,Patcom2,"FixedAttack",0,0,40,40,0
		ORDER		1,0,Puffin,"FixedAttack",0,0,40,40,0

		NOCONTACT	Patcom1,OFF
		NOCONTACT	Patcom2,OFF
		NEW_ALLEG	Puffin,INDIE


;------------Routines-------------------
		
End:
		END

If you play the mission, you'll notice that it is starting to look like one! There is still one thing missing - dialogue.

G. Dialogue and objectives

Dialogue must be loaded, just like everything else in I-War. Go to the beginning of the script and add the following REGLOADs:

REGLOAD T10,"\psg\resource\text\tutorial\t10.txt",TXT2TXT
REGLOAD T20,"\psg\resource\text\tutorial\t20.txt",TXT2TXT
REGLOAD T30,"\psg\resource\text\tutorial\t30.txt",TXT2TXT

REGLOAD Objv,"\psg\resource\text\tutorial\objv.txt",TXT2TXT

These will load three pieces of dialogue we will soon make, and an objective file that we will also make. The files will be referred to as T10, T20, T30 and Objv.

Go to the \psg\resource\text\tutorial\ directory under your I-War path. You will need to create the 'tutorial' folder since it doesn't exist yet. Once you have done that, create four text files: t10.txt t20.txt t30.txt and objv.txt.

Edit the t10.txt so that it look like this:

<S=STC H=Haas>
(S:STC to Dreadnaught. You have clearance to undock.
H:Capsule jump destination set for Delta Pavonis system.)

Now save the file. Notice that there are two speakers: S and H. In the first line we declared S as STC and H as Haas.

Also note that the dialogue is inside brackets. This must be so or it will cause a crash. Open the t20.txt and add the following:

<D=DuBois H=Haas>
(D:We have reached the patrol area, sir..
H:I'm receiving a distress signal from a nearby ship.
P:Lets move to investigate.)

Notice that we didn't declare P as anything. This is because P is always the player. Next we need to select the point where we play the dialogue. Go back to line that said WAIT_UNTIL INSYSTEM,7 and add the following two commands above it:

DIALOGUE T10
WAIT_UNTIL DIALOGUE_OVER,T10

This plays the dialogue and waits until it gets finished. Now go the line that said WAIT_UNTIL NEARTO,Dreadnt,Waypoint1,1000000 and add the following under this line:

DIALOGUE T20
WAIT_UNTIL DIALOGUE_OVER,T20

This plays the second dialogue just after we reach the patrol waypoint.

Next we'll do the objectives. Edit the objv.txt file and add the following:

10:Jump to Delta Pavonis system
20:Go to patrol area
30:Investigate distress signal
40:Destroy indie ships

Now save the file and go back to the mission script.

We need to declare that file as the objective file. Add the line:

DEC_OBJV Objv

above the CAMERA commands. This is where I generally place the objective commands. The previously loaded objv.txt file is now the objectives file.

If you play the mission now, you will notice that all the objectives are visible. This is not good since the indie ambush is supposed to be a surprise. Add the following lines under the previous command:

SHOW_OBJV ON,10,20
SHOW_OBJV OFF,30,40

This makes objectives number 10 and 20 visible and 30 and 40 invisible. Next we'll set the scores for the objectives. Add the line:

SCORE_OBJV 10,250, 20,250, 30,500, 40,1000

This gives objectives 10 and 20 the score of 250 points. Completing objetive 30 gives 500 points and completing 40 gives 1000 points. Therefore we can get a total of 2000 points + kill bonuses for this mission. We still need to set the places where the objectives are concidered to be completed.

Objective 10 was to Jump to Delta Pavonis system. This is obviously done once we are in Delta Pavonis. Add the line:

SET_OBJV DONE,10

Under the line that says WAIT_UNTIL INSYSTEM,7. See if you can place the SET_OBJV command for objective 20 yourself. It is supposed to be complete when the player reaches the patrol waypoint. You compare your results at the end of this chapter.

Remember that we set the objectives 30 and 40 as invisible. They wont show up until we make them to do that. Add the line:

SHOW_OBJV ON,30

right under the line that says WAIT_UNTIL DIALOGUE_OVER,T20. This sets objective 30 visible when dialogue t20 has finished. Now lets concider the mission completed once all indie ships have been destroyed. SUCCESS command sets the mission as successfully completed and END finishes it. Add the lines:

WAIT_UNTIL NOSHIPS,INDIE
SUCCESS
END

Right under the line that says NEW_ALLEG Puffin,INDIE. This was the last line in the script.

Place the rest of the objectives yourself. Once you have finished compare them with mine.

Your script should now look like this:

;----------------------------------------------
;	Mission template.
;----------------------------------------------

;--- Declarations -----------------------------

SCENEITEM	Dreadnt,Destroyer,Puf1,Puf2,Puf3,Puf4,Pat1,Pat2

MODEL		DreadMd,SphMd,PufMd,FightMd,DestroyerMd,GunStarMd,BombMd,NAVYBaseMd,PatComMd
MODEL		IPufMd,IPatComMd

RESOURCE	Txt1,Txt2,Txt3,Txt4,Txt6,Txt8,Txt9,Txt10,Txt11,TWin,TLose

SCENEITEM	LP4,WP0,WP1,WP2

VAR			Temp

;		GENESIS

;--- Resources ----------------------------------

		REGLOAD	DreadMd,"\psg\resource\shapes\CorvAsm_rto.lwo",LWO2BRM
		REGLOAD	CommandMd,"\psg\resource\shapes\Command_RTO.lwo",LWO2BRM
		REGLOAD CruiserMd,"\psg\resource\shapes\Cruiser_RTO.lwo",LWO2BRM
		REGLOAD FighterMd,"\psg\resource\shapes\PuffinPilot.lwo",LWO2BRM
		REGLOAD	HangerMd,"\psg\resource\shapes\hanger_rto.lwo",LWO2BRM
		REGLOAD PatMd,"\psg\resource\shapes\PatCom_RTO.lwo",LWO2BRM
		REGLOAD	PufMd,"\psg\resource\shapes\Puffin_rto.lwo",LWO2BRM

		LOADMAP "INDEX_TOP","\psg\resource\art\textures\indieships\PCT_Skul.pix"
		LOADMAP "INDEX_BOT","\psg\resource\art\textures\indieships\PCB_Skul.pix"
		REGLOAD	IndiePatMd,"\psg\resource\shapes\PatComI_rto.lwo",LWO2BRM

;--- Load text -------------------

		REGLOAD	T10,"\psg\resource\text\tutorial\t10.txt",TXT2TXT
		REGLOAD	T20,"\psg\resource\text\tutorial\t20.txt",TXT2TXT
		REGLOAD	T30,"\psg\resource\text\tutorial\t30.txt",TXT2TXT

		REGLOAD	Objv,"\psg\resource\text\tutorial\objv.txt",TXT2TXT

;--- Player and initial setups ------------------

		GENESIS

		CREATE_SHIP Dreadnt,DreadMd,"Dreadnaught CNV-301",CORVETTE,NAVY,0,0,0,-180,0,0
#INCLUDE pcorvette.shp
		PLAYER	Dreadnt

		SYSTEM "8","L5"


;------------------------------------------------

		DEC_OBJV	Objv
		SHOW_OBJV	ON,10,20
		SHOW_OBJV	OFF,30,40
		SCORE_OBJV	10,250, 20,250, 30,500, 40,1000

		CAMERA	CamWep,CAM_CHASE,Dreadnt,0,0,-20000
		CAMERA	CamPly,CAM_PLAYER,Dreadnt,0,0,-20000

#INCLUDE test0_x.gui
		REGLOAD	SphMd,"\psg\resource\shapes\mikenebfrc.lwo",LWO2BRM

		STARFIELD	1200,ON

;-------------------------------------
;Mission script begins:


		CREATE_SHIP STC,HangerMd,"Pavonis L5 STC",STATION,NAVY,1000000,0,1000000,-180,0,0
#INCLUDE armedstc.shp

		DOCK	Dreadnt,STC,1,0

		SET_TARG_LP 7,"L4"

		DIALOGUE	T10
		WAIT_UNTIL	DIALOGUE_OVER,T10

		WAIT_UNTIL	INSYSTEM,7
		SET_OBJV	DONE,10

		WAYPT	 Waypoint1,"Patrol Area",5000000,300000,100000

		WAIT_UNTIL	NEARTO,Dreadnt,Waypoint1,1000000

		DIALOGUE	T20
		WAIT_UNTIL	DIALOGUE_OVER,T20

		SET_OBJV	DONE,20
		SHOW_OBJV	ON,30

		RELATIVE	Waypoint1

		CREATE_SHIP Puffin,PufMd,"Tug T-4601",TUG,NEUTRAL,0,0,3000000,-180,0,0
#INCLUDE puffin.shp

		ORDER 1,0,LASTSHIP,"Drift",0,0,40,40,0

		ROT LASTSHIP,0,0,0,4,7,3
		VEL LASTSHIP,20,44,23

		WAYPT	Waypoint2,"Distress Call",0,0,0
		ATTACH_WAYPT	Waypoint2,Puffin

		RELATIVE	Puffin

		CREATE_SHIP Patcom1,IndiePatMd,"Dancing Devil",PATCOM,INDIE,700000,500000,0,-90,0,0
#INCLUDE patcom.shp

		CREATE_SHIP Patcom2,IndiePatMd,"Uncle Jack",PATCOM,INDIE,-700000,500000,0,90,0,0
#INCLUDE patcom.shp

		NOCONTACT	Patcom1,ON
		NOCONTACT	Patcom2,ON

		WAIT_UNTIL	NEARTO,Dreadnt,Puffin,400000
		SET_OBJV	DONE,30
		SHOW_OBJV	ON,40

		ORDER		1,0,Patcom1,"FixedAttack",0,0,40,40,0
		ORDER		1,0,Patcom2,"FixedAttack",0,0,40,40,0
		ORDER		1,0,Puffin,"FixedAttack",0,0,40,40,0

		NOCONTACT	Patcom1,OFF
		NOCONTACT	Patcom2,OFF
		NEW_ALLEG	Puffin,INDIE

		WAIT_UNTIL NOSHIPS,INDIE
		SET_OBJV	DONE,40
		SUCCESS
		END
;------------Routines-------------------
		
End:
		END