Take On Mars

Take On Mars

64 vurderinger
Scenario creating I: Starting in a landing vehicle
Af dariusz1983
Scenario Creating Part 1

Every cool scenario starts off with the player sitting in his landing module that is plummeting through the air at a very high velocity. The window blinds are closed down, everything is shaking and rumbling and then the thrusters kick in, slowing us down. The window blinds go up and the landing module slowly descents and finally lands us on mars. The adventure begins. Having that start in a scenario is actually quite easy, this guide shows you how.

This modding guide is the first in a series of guides trying to show you guys and gals how to make cool scenarios. I have spent some quality time going through the code and the config files, experimenting etc. and have found some really fun stuff for everyone to try out.

The guide series:
  1. Starting in a landing vehicle (this guide)
  2. Triggers and Events
  3. Displaying messages to the player
  4. Data Pad guide (how to create your own data pad)
  5. Supply Drop with custom goodies.
  6. Mission Objectives

If there's anything you guys would like to see, let me know in the comments. I am going to create a scenario that actually uses all of the mentioned "features" and upload it as a reference.
   
Pris
Føj til foretrukne
Gjort til foretrukken
Fjern som foretrukken
Creating the scenario
First, create a scenario in the in-game scenario editor. Very simple...see Appendix A on a very brief introduction into the scenario editor. Add a character on the ground, where, doesn't matter. Now, add a manned landing vehicle, but create it with the "Landing towards cursor" option. It is a little bit confusing since you can't see it. It is actually there but located at a predefined "reentry" position which every world defines. It has a certain angle, preset velocity etc. I guess you could look for it, but there is no need to.

Now save your scenario and play it. As you would expect you start in the free fly camera mode. Pressing 'F' will gain control of your character. By now you should hear the sound of the lander comming in. It should land close to your position. Unill now, nothing new nor exciting. Now let's spice things up a little.
Starting as the player
Now let's get our hands dirty. The first thing we will fix is starting the scenario as the player character.

There are two ways to do it. One is via scenario editor. See Appendix A.This way should be preferred, as it minimizes your workload and keeps you from fiddling with the scenario file...at least as much as possible. The other is a little adjustment in the scenario file itself:

One thing to bear in mind is that the scenario files, as they are beeing generated within the scenario editor, don't use the "classical" end of line character combination CR (Carriage Return) + LF (Linefeed) that Windows OS is used to. So if you open that file with say notepad, it won't make much sense. In fact, you shouldn't edit it in notepad at all. Use Wordpad with the setting: "No Linebreak". I use gVim, which is a specialized text/code editing tool. Not very easy to use for beginners, but once you figured it out you won't use anything else (in my humble opinion...you can start wars over this).

Open the scenario file (*.scn) in a text editor, you don't need anything fancy.
Look for the line saying
PLAYER 0
This is the place we have to edit. Replace the 0 with the ID of the character you want the player to control on scenario start.



To find the ID look at the character definition. In my example, Justin has the ID 7.




My player definition line now looks like this:
PLAYER 7

And that's it. Save the file. Next time you load that scenario, it won't start in free fly mode but in control of said player.

Now onto bigger things.

Locating the scenario file
The rest of the work we'll do editing the scenario (text) file itself. But first, let's find it.

All the custom scenarios you make using the scenario editor are in a folder like this:
C:\Program Files (x86)\Steam\userdata\12345678\244030\local\addons\scenarios
Given you have installed the steam client under
C:\Program Files (x86)
It might look differently on your pc. The long number after
userdata
will also be different and is your own personal ID number. The 244030 is the Take On Mars workshop ID.

Each scenario can come with up to three different files:
  • myscenario.scn: The actual scenario file
  • myscenario.jpg: Your scenario picture to be displayed on steam/in the game
  • myscenario.script: A special scenario script file for coding, objectives, more later.

Obviously, only the first one is mandatory and for the purpose of this guide, the only important file.
Starting sitting in a vehicle
The next thing we will change is our player starting sitting in our airbourne landing vehicle. We could try and locate it in the editor and move our character there. The result would be the player not sitting in a seat in the lander but rather tumbling about.

Much easier is adding a PASSENGERS definition to the scenario file. By the way, the coordinates the lander tries to "hit" are defined by the value following the LZ:
This is the place to change the landing position after you've created the scenario.

But back to our passenger, this is what I have to write for my Justin character with the ID 7:

The line is as follows:
VEHICLE "Zeus" PASSENGERS 0 false 7

The VEHICLE tells the parser that there is a vehicle related definition following. Which vehicle is defined by the name, here, Zeus. PASSENGERS initiates a passengers definition. There can be several, depending on how many free seats a vehicle has. Each passenger needs a seperate line like this. Next is the seat number, 0 beeing the first seat. A two seater lander only has seats 0 and 1 available. The boolean value false tells the game that the passenger is NOT the current driver, which is absolutely fine with a lander. A landing vehicle is not ment to be "driven" by the player (yet ;)). The last number, in my example 7 is Justins character ID.

And thats it. Our final result. Have fun and good luck on mars.
Example scenario
You can find a working example scenario here:
http://sp.zhabite.com/sharedfiles/filedetails/?id=833017992
Appendix A: The Editor
This micro guide will give you a step by step on how to create your very first scenario.

Step 1
Start the Editor from the game's main menu. It will ask you to choose a location (world) you'd like to start creating your scenario in. For the purpose of this guide, choose something with gravity, the moon, mars, earth. I wen't with the Victoria Crater:

Hint
Starting in the editor, moving your mouse cursor actually moves the camera. Navigation is a bit tricky. It works the same as in normal game mode with the free fly camera. WSAD keyboard keys control the camera movement. In order to slow them down scroll down with your mouse wheel. To speed up, scroll up. In order to click on any buttons etc. you have to enable the mouse cursor. You do that by right clicking. Now the camera is "frozen" and you can move your cursor around. To go back to camera move mode, right click again.

Step 2

Click on the "New Scenario" button. This will prompt a little dialog in which you can enter the Scenario name and the filename.

If for some reason the Create button becomes disabled and you can't click it, that usually means, that there is a scenario file with the name you typed already saved.

Hint
The text elements (line edits) in which you can enter text are a bit weird. They don't behave like what you're used to from windows/linux/os applications. You don't click in them in order to enter text, you have to hover your mouse over them in order to be able to type any text. This is true for all the line edit elements in the scenario editor (and probably the rest of the game).

Step 3
Now zoom a little to the ground and create a vehicle with the option "Landing towards cursor".

To do that click on the second item in the new tab. Choose a vehicle from the list. We went for the cargo truck (you can pick the MDV, a small/big lander, etc.).

You won't see it. Trust that it is there.

Step 4
Now lets create the player. Pick a suite type (if you're not on Earth, I wouldn't recommend going without the suit). It doesn't matter where you place the character.


After you placed him, select the character with your mouse and make sure the "Is Start Unit" option is set to TRUE. That way, when the scenario loads, you'll start playing that character.


Step 5
That's almost it. Save your scenario with the save button. Now you should follow the step mentioned above in this guide to make sure you start the scenario sitting in your vehicle.
34 kommentarer
AdorableSparrow 1. maj 2017 kl. 18:09 
why is this sooooooooo hard????????????
Myst Leissa 18. feb. 2017 kl. 16:26 
What happened to the Mission Objectives Tutorial? It's been a few days now since it's been available - I'm interested in learning the syntax in the script for writing objectives :/
INFIDEL 15. feb. 2017 kl. 11:39 
how do I spawn a driver rather than a passenger in Single Player? MP would be cool too but not sure how to do this in the eo_coopertive.h file.
dariusz1983  [ophavsmand] 12. jan. 2017 kl. 23:16 
That is true. Many guys at my work place use Notepad++. It's free, as you said, quite easy to use, doesn't load the entire file into RAM (like Notepad does).
Vas 12. jan. 2017 kl. 22:53 
A better text editor would be Notepad++ Or Editpad (I use Editpad Pro but Notepad++ is good too and free.
dariusz1983  [ophavsmand] 31. dec. 2016 kl. 18:18 
I always save with typing :w ;). Well, notepad has different settings on the character set. Some may display the end of line incorrectly. Windows, usually, wants a CR+LF as a end of line character.
INFIDEL 31. dec. 2016 kl. 17:53 
Looks like gVim solved the issue for me... I have no idea how I got Notepad working in the past; also, surprised Wordpad didn't do much of a better job for me since it seems to have worked for Whistler.

Not looking for a tutorial on gVim, but if there is anything special we should do when saving a gVim edit other than File->Save; it might come in handy to avoid screwing up a .scn file.

Thanks
INFIDEL 31. dec. 2016 kl. 17:25 
Haven't played around with editing since April... it seems I've run into a problem viewing the .scn files in Notepad.

Created a thread (hope it's the best place to park this discussion):
https://sp.zhabite.com/app/244030/discussions/9/154645299386586917/

I'll try some other text editors, but my recollection was that Notepad worked fine in the past; anyone encounter this before?
http://sp.zhabite.com/sharedfiles/filedetails/?id=831369388
dariusz1983  [ophavsmand] 24. nov. 2016 kl. 9:54 
I think it's casesensitive, so yes, PASSANGERS. Important think is to make sure Wordpad saves it as an ASCII file. It might screw with the new line characters.
Whistler 23. nov. 2016 kl. 1:37 
Thanks for the quick reply:D Yup, just one long continuous line. Didn't think of wordpad, checked it now, is perfect, thanks. Quick question while i got you, the passengers line, Capitol P, all uppercase PASSENGERS or what? Have tried everything I could think of, haven't been able to get the dude in my scenario to arrive in the lander. Might have been notepad screwing with the .scn file, but just thought I'd ask before spending another couple hrs going round in circles... ;)