Difference between revisions of "Nexus:TJI Mission Making"

From NexusWiki
Jump to: navigation, search
(Created page with '=== '''''WARNING: While this is in place, the tutorial is not complete!''''' === ---- ===='''''Mission Creation Tutorial'''''==== Here, in this tutorial, is where we’ll lear...')
 
Line 56: Line 56:
  
 
[[File:MM_5.png|centre]]
 
[[File:MM_5.png|centre]]
 +
 +
 +
2) In the drop down Type field, select ‘navpoint’, and rename it to PatrolPoint (Just a quick point, you can’t enter a ‘'''''space'''''’ in this field).
 +
 +
3) Click '''''Add''''', and our navpoint will now magically appear in the centre of the scene (quick point - upon creation, objects are placed at the centre of scene!) and be high‐lighted. All that marks a navpoint in the editor is a small white arrow when it’s selected or the four corner squares when the cursor hangs over it. Like this…
 +
 +
 +
[[File:MM_6.png|centre]]
 +
 +
 +
So don’t be alarmed if it suddenly disappears, it’s still there. Believe it or not, that’s as good a place as any for it, so we’ll leave that alone and move onto the asteroid field. Once again, click on the '''''Add Objects''''' button to bring up the secondary window. Only this time, we’re more interested in the bottom half.
 +
 +
'''''Name prefix''''' ‐ As asteroid fields are scenery and very rarely will we do anything but hide amongst them, there’s no reason to assign our own name. Best to let the editor handle it.
 +
 +
'''''Radius''''' – Now this is what we want to adjust, we can make any size field we want, just bear in mind that it will always have ‘'''''spherical'''''’ nature to it (we can stretch it as much as we want, but we can’t make weird shapes out of a single field) and the unit measurements are in metres. But for our purposes, we just want a small field, so set all three values to 5000.
 +
 +
'''''Class Interval''''' – There are actually thirty‐five different asteroids we can choose from, with these two fields, we can specify just how many of them we want to use but I normally find the default values to be ok (and I’ve no idea what the ClassPow is).
 +
 +
'''''MaxCount''''' – Self explanatory here, how many ‘roids do you want? Just remember, the more you have, the harder your pc has to work! As I said earlier, we only want a small field, so set this value to 100. And click on '''''Generate'''''. Just like the navpoint, this field is just fine where it is.
 +
 +
Just like using the other editor, I’d recommend saving at regular intervals.
 +
 +
Next up, we’ll add two Gorg destroyers. As I don’t particularly like cheese, we’re gonna call them ‘'''''Gorgonzola'''''’ and ‘'''''Edam'''''’. So by now you should have already brought up the secondary window. In the '''''Type''''' window, make sure that ship is selected. Then, in '''''ShType''''', scroll down till you find number '''''100'''''. As you just saw, once you selected it, the '''''Class''''' and '''''Race''''' fields sorted themselves out… nice, huh? Now all you have to do is fill in the '''''Name''''' field and press '''''Add''''' and it’s in our scene.
 +
 +
 +
[[File:MM_7.png|centre]]
 +
 +
 +
Ok, open it up once more and you’ll notice that it’s still filled in apart from the name, kinda makes life easier when you’re bringing in multiple ships of the same type. So change the name (‘'''''Edam'''''’) and add the second ship.
 +
 +
So now that you know how, I want you to add three more ships – a human cruiser ('''''ShType 135''''') named ‘'''''Defiance'''''’, along with two destroyers ('''''ShType 133''''') named ‘'''''Striker'''''’ and ‘'''''Lightning'''''’. Now that you’ve added them, it’s time to learn about positioning (after all, we can’t leave them on top of each other!).
 +
 +
First, let’s get the two Gorgs sorted out. Select one by simply clicking on it (or on its name in the upper panel of the Control pane). Also, if you double click on either of these, then you’ll zoom in for a close up of the object. Next, hold down '''''SHIFT''''' and then move your mouse around… and off she goes! With '''''SHIFT''''' pressed we gain access to the abilities of two dimensional movement, so we can now go up, down, left and right to our hearts content. But space is three‐dimensional I hear you cry! (Well, maybe not you guys, but there are enough voices in my head to make up for you), well, in order to gain access to this third plane of movement, we press '''''SHIFT''''' + '''''LMB''''' then move the mouse back and fore. So move those two ships to a starting position of your choice (but not too far away, keep them within two thousand meters of our navpoint!).
 +
 +
Next up select all three player ships ('''''CTRL''''' + '''''LMB''''' and don’t worry if they’re still on top of each other, we’ll
 +
sort that in a moment) and move them about '''''15k''''' from the navpoint (Hint: If you want to know how far apart two objects are,
 +
then select one and move the cursor over the second. In the command panes lower window there’s a line that tells you). With that done, zoom in on the cruiser (remember, double click on it or find it in the list), then rotate the camera to look at the Gorg ships.
 +
 +
Using the '''''CTRL''''' + '''''LMB''''' combo, select the cruiser, then the two destroyers (in this order, it’s important for the
 +
next bit!). Next, by pressing and holding '''''R''''' then moving the mouse around, you can rotate the ships as much as you want. What I’d like you to do now, is point our ships towards the navpoint. After all, that’s where we’re heading. The final thing we’re going to do with these ships, is use a nifty little feature of the editor that’ll put our ships in formation. In the previous paragraph, I said to select the cruiser first, this is because the command we’re about to use makes the first ship we select the formation leader. So without further ado (and with the three human ships selected) press '''''CTRL''''' + '''''F'''''.
 +
 +
The final thing we have to do now is orientate the two Gorg ships to face our formation. With that done, save the mission ('''''CRTL''''' + '''''S''''') and exit ('''''CTRL''''' + '''''Q'''''). That’s the last we’ll see of the mission editor now (well, for this mission at least) as everything else that’s left will be done with our text editor.
 +
 +
Make your way back to our '''''mod_missions''''' folder and open the '''''.mission''''' file there, then we’ll get ‘stage 2’ underway. Just like the solar system editor, the mission editor has filled in an awful lot of ‘positional’ and ‘type’ data for us, saving us from a hell of a lot of repetitive typing. Also, before we do delve into this, I’d just like to make you aware of one of my habits that you may wish to take up – but it isn’t required by the game in any way.
 +
 +
Throughout the '''''.mission''''' text, you’ll see the following symbol ‘'''''//'''''’. For those who’ve scripted before or know a little about the C++ language (on which this is loosely based, I believe), you’ll know what it means. But for those that don’t, this is known as “commenting out” and basically means we’re adding a comment for the human reader to understand and anything behind those to slashes will be ignored by the pc. So I use this feature to write lots of notes about what I’m scripting so when it goes wrong (and it invariably does. :( ) then I can find the relative section without
 +
too much brainache.
 +
 +
And save your files often, I cannot stress this enough! (Although you will be after watching a few hours’ worth of work disappear at the press of the wrong key!) So now that you’ve opened the '''''.mission''''' file (and found an '''''ENTITIES''''' section has been added), I’d like you to make a few little amendments to the bit you typed before. So, aside from the '''''Deflocation''''' line, you should now have…
 +
 +
 +
[[File:MM_8.png|centre]]
 +
 +
 +
Now everything else that we type into this file will go between the two words ’'''''RULES'''''’ and ‘'''''END'''''’ and the reason that my demo section is in bold is to make it stand out more for your benefit, not for any technical reason. So let’s create our first section…
 +
 +
This is always the ‘'''''SceneInit'''''’ rule and as its name suggest, this is where we set most of the names and variables for the mission. From here we’ll also be calling the mission machines (remember Arparso’s tutorial on machines, states,etc?) that the game will require. So let’s fill in what we can of it (because we’ll probably becoming back to it time and again to add little bits as we go along) and I’ll explain the different bits along the way.
 +
Time to start typing...
 +
 +
 +
[[File:MM_9.png|centre]]
 +
 +
 +
Ok, so we’ve now inserted our first actual, complete rule into the script. In order for us to issue commands, set conditions or do anything really, all the objects that we plan on doing things with need to be given names… or ‘'''''variables'''''’ to be technical. Without these, the game is effectively shouting at everything and nothing is paying the slightest bit of attention, therefore nothing appears to happen when we run our mission (much, much later). You may also notice that I put a space in “'''''Patrol Point'''''”? For some reason, we can’t put it in with the Mission Editor, but we can put spaces in at this point with no problems whatsoever (just don’t forget to adjust the name in the '''''Entities''''' section too or the game will get confused). And a final point before I move on to the next few lines of script, the reason I’ve put comments on the '''''END''''' lines is because you can get a strings of mutiple ''''''END'''''’s in a row. As I’m sure you can imagine, this could get awfully confusing! So this is just a measure to help keep things clear.
 +
 +
In this next section we’ll add some rules to hide our ships, set our objectives up and make sure the Gorgs are hostile. So add these lines to the '''''SceneInit'''''…
 +
 +
 +
[[File:MM_10.png|centre]]

Revision as of 01:55, 4 March 2010

WARNING: While this is in place, the tutorial is not complete!


Mission Creation Tutorial

Here, in this tutorial, is where we’ll learn how to place objects within a mission area and then give them instructions on what to do and how to behave. Now before I begin, I’d just like to offer thanks once again to Jusas for writing the original tutorial (Missionmaking(for dummies)) which I’m once more using as a foundation (as with the Nexus:TJI Creating Solar systems tutorial). We won’t go too deep into the Nexus depths or I’ll never finish this tutorial, simply because there’s way too much (and I sure as heck don’t understand half of it!). But by the time you finish this section, you will have a playable mission and know enough to go paddling in the great Nexus ocean. Now, just like the previous tutorial, we can’t just open the editor and make missions. It doesn’t work that way, we’ve got a few things that we’re going to have to prepare first…

Before we can do anything, we have to decide what’s going to happen, what it is we’re going to create… a plan. It’s all fine and well saying “let’s write a mod”, but about what? We have to figure all this out before we can write it. So, as this is my tutorial, I’ve decided that the scenario is going to be…

As part of its patrol, a small human fleet is to investigate an asteroid field. After all, there’s no telling what could be hiding within from long range sensors – a look see is required. Our ships will ‘jump in’ and proceed to the field, where upon they will discover some Gorg ships that shouldn’t be there. As per convention, we have to warn them and give them a chance to withdraw. After that, we get to kick ass. We’ll also have two objectives to achieve as well. The first, is our primary objective and it is to eliminate any hostile presence. The second will, strangely enough, be a secondary objective to ensure the survival of our main ship.

Ok, we now have a simple plan of action, so let’s get to work…

Right then, navigate to the universe folder you created so long ago and create a new text document. Then rename it to main.ini, whenever we change a file type (and we’ll be doing it quite often!), our pc will complain that the file might not work, etc. Don’t worry, it will, so just say yes…


MM 1.png


Then open our new file and type in the following…


MM 2.png


Save and close, that’s it for this file. What we’ve done here is make an entry in the menu for our new mod, enabling us to load it into the editor. There are other lines you could enter, but they’re not required by us for this mod. Next up, I’d like you to go to the ‘mod_missions’ folder and create a new text file, naming it ‘My_First.mission’. Now this file is where most of the magic will take place and we’re going to tackle it in two stages, so… stage one.

First, make your way to the solar system file you created earlier. Open it up and locate a “NAVPOINT” entry (if you added more than one, then choose any. It’s completely up to you.)


MM 3.png


Select and copy the text in the quotation marks, then close. Second, go back to the mod_mission folder and open the .mission file and type the following…


MM 4.png


And paste your navpoint name into the highlighted section, save it and close.

Remember I told you that the nav‐marker was probably the most important thing you could add to a solar system towards the end of Nexus:TJI Creating Solar systems tutorial? Well this is the reason why. Without a ‘nav’ location, the game won’t know what scenery to load and therefore, won’t load our mission. Oh, and while I’m thinking about it. The very first line is important because not only will it be used to denote the missions place in a campaign (should you chose to go down that road) but also, another file that we’ll play with later requires it so that it can associate the missions objective with the mission script.

Run the mod_tools.exe from the Nexus\mod_tools folder once again, select our ‘Tutorial’ from the drop down menu and click on the Mission Editor. From the menu that appears, we should now be able to select ‘My First Mission’ by either double‐clicking or high‐lighting it, then clicking on the edit mission at the bottom of the screen. Do so, and we’ll enter our mission area. Just like the Solar System editor, this is a “wysiwyg” editor. So everything is graphical at this point. When we start up this beastie, three windows will open, the big window in the middle is where we’ll do all our placing and manipulating. A second window (the Nexus Console) will open up behind this main window, you can ignore this window for now as it’s mainly used for debugging purposes (just don’t try and close it). Finally, the third, smaller window will open up to the left. This is our command pane.

We’re not going to go overboard here, all we’re going to add is a nav‐point, an asteroid field and two small fleets. So, the nav‐point first…

1) Click the Add Objects button in the command pane. This will open the following window.


MM 5.png


2) In the drop down Type field, select ‘navpoint’, and rename it to PatrolPoint (Just a quick point, you can’t enter a ‘space’ in this field).

3) Click Add, and our navpoint will now magically appear in the centre of the scene (quick point - upon creation, objects are placed at the centre of scene!) and be high‐lighted. All that marks a navpoint in the editor is a small white arrow when it’s selected or the four corner squares when the cursor hangs over it. Like this…


MM 6.png


So don’t be alarmed if it suddenly disappears, it’s still there. Believe it or not, that’s as good a place as any for it, so we’ll leave that alone and move onto the asteroid field. Once again, click on the Add Objects button to bring up the secondary window. Only this time, we’re more interested in the bottom half.

Name prefix ‐ As asteroid fields are scenery and very rarely will we do anything but hide amongst them, there’s no reason to assign our own name. Best to let the editor handle it.

Radius – Now this is what we want to adjust, we can make any size field we want, just bear in mind that it will always have ‘spherical’ nature to it (we can stretch it as much as we want, but we can’t make weird shapes out of a single field) and the unit measurements are in metres. But for our purposes, we just want a small field, so set all three values to 5000.

Class Interval – There are actually thirty‐five different asteroids we can choose from, with these two fields, we can specify just how many of them we want to use but I normally find the default values to be ok (and I’ve no idea what the ClassPow is).

MaxCount – Self explanatory here, how many ‘roids do you want? Just remember, the more you have, the harder your pc has to work! As I said earlier, we only want a small field, so set this value to 100. And click on Generate. Just like the navpoint, this field is just fine where it is.

Just like using the other editor, I’d recommend saving at regular intervals.

Next up, we’ll add two Gorg destroyers. As I don’t particularly like cheese, we’re gonna call them ‘Gorgonzola’ and ‘Edam’. So by now you should have already brought up the secondary window. In the Type window, make sure that ship is selected. Then, in ShType, scroll down till you find number 100. As you just saw, once you selected it, the Class and Race fields sorted themselves out… nice, huh? Now all you have to do is fill in the Name field and press Add and it’s in our scene.


MM 7.png


Ok, open it up once more and you’ll notice that it’s still filled in apart from the name, kinda makes life easier when you’re bringing in multiple ships of the same type. So change the name (‘Edam’) and add the second ship.

So now that you know how, I want you to add three more ships – a human cruiser (ShType 135) named ‘Defiance’, along with two destroyers (ShType 133) named ‘Striker’ and ‘Lightning’. Now that you’ve added them, it’s time to learn about positioning (after all, we can’t leave them on top of each other!).

First, let’s get the two Gorgs sorted out. Select one by simply clicking on it (or on its name in the upper panel of the Control pane). Also, if you double click on either of these, then you’ll zoom in for a close up of the object. Next, hold down SHIFT and then move your mouse around… and off she goes! With SHIFT pressed we gain access to the abilities of two dimensional movement, so we can now go up, down, left and right to our hearts content. But space is three‐dimensional I hear you cry! (Well, maybe not you guys, but there are enough voices in my head to make up for you), well, in order to gain access to this third plane of movement, we press SHIFT + LMB then move the mouse back and fore. So move those two ships to a starting position of your choice (but not too far away, keep them within two thousand meters of our navpoint!).

Next up select all three player ships (CTRL + LMB and don’t worry if they’re still on top of each other, we’ll sort that in a moment) and move them about 15k from the navpoint (Hint: If you want to know how far apart two objects are, then select one and move the cursor over the second. In the command panes lower window there’s a line that tells you). With that done, zoom in on the cruiser (remember, double click on it or find it in the list), then rotate the camera to look at the Gorg ships.

Using the CTRL + LMB combo, select the cruiser, then the two destroyers (in this order, it’s important for the next bit!). Next, by pressing and holding R then moving the mouse around, you can rotate the ships as much as you want. What I’d like you to do now, is point our ships towards the navpoint. After all, that’s where we’re heading. The final thing we’re going to do with these ships, is use a nifty little feature of the editor that’ll put our ships in formation. In the previous paragraph, I said to select the cruiser first, this is because the command we’re about to use makes the first ship we select the formation leader. So without further ado (and with the three human ships selected) press CTRL + F.

The final thing we have to do now is orientate the two Gorg ships to face our formation. With that done, save the mission (CRTL + S) and exit (CTRL + Q). That’s the last we’ll see of the mission editor now (well, for this mission at least) as everything else that’s left will be done with our text editor.

Make your way back to our mod_missions folder and open the .mission file there, then we’ll get ‘stage 2’ underway. Just like the solar system editor, the mission editor has filled in an awful lot of ‘positional’ and ‘type’ data for us, saving us from a hell of a lot of repetitive typing. Also, before we do delve into this, I’d just like to make you aware of one of my habits that you may wish to take up – but it isn’t required by the game in any way.

Throughout the .mission text, you’ll see the following symbol ‘//’. For those who’ve scripted before or know a little about the C++ language (on which this is loosely based, I believe), you’ll know what it means. But for those that don’t, this is known as “commenting out” and basically means we’re adding a comment for the human reader to understand and anything behind those to slashes will be ignored by the pc. So I use this feature to write lots of notes about what I’m scripting so when it goes wrong (and it invariably does. :( ) then I can find the relative section without too much brainache.

And save your files often, I cannot stress this enough! (Although you will be after watching a few hours’ worth of work disappear at the press of the wrong key!) So now that you’ve opened the .mission file (and found an ENTITIES section has been added), I’d like you to make a few little amendments to the bit you typed before. So, aside from the Deflocation line, you should now have…


MM 8.png


Now everything else that we type into this file will go between the two words ’RULES’ and ‘END’ and the reason that my demo section is in bold is to make it stand out more for your benefit, not for any technical reason. So let’s create our first section…

This is always the ‘SceneInit’ rule and as its name suggest, this is where we set most of the names and variables for the mission. From here we’ll also be calling the mission machines (remember Arparso’s tutorial on machines, states,etc?) that the game will require. So let’s fill in what we can of it (because we’ll probably becoming back to it time and again to add little bits as we go along) and I’ll explain the different bits along the way. Time to start typing...


MM 9.png


Ok, so we’ve now inserted our first actual, complete rule into the script. In order for us to issue commands, set conditions or do anything really, all the objects that we plan on doing things with need to be given names… or ‘variables’ to be technical. Without these, the game is effectively shouting at everything and nothing is paying the slightest bit of attention, therefore nothing appears to happen when we run our mission (much, much later). You may also notice that I put a space in “Patrol Point”? For some reason, we can’t put it in with the Mission Editor, but we can put spaces in at this point with no problems whatsoever (just don’t forget to adjust the name in the Entities section too or the game will get confused). And a final point before I move on to the next few lines of script, the reason I’ve put comments on the END lines is because you can get a strings of mutiple 'END’s in a row. As I’m sure you can imagine, this could get awfully confusing! So this is just a measure to help keep things clear.

In this next section we’ll add some rules to hide our ships, set our objectives up and make sure the Gorgs are hostile. So add these lines to the SceneInit


MM 10.png