Meteor 2 Map Editor Documentation

 

Contents


Frequently Asked Questions

Q. How do I make a door?
A. See Sectors

Q. How do I make an exit?
A. See Single Command Scripting

Q. How do I make a sound trigger?
A. See Single Command Scripting


1. Introduction/Overview

The map editor included with M2 was used to create all of the missions in the game.  The editor is mode sensitive which means that you can only edit elements when in a specific mode (i.e. you have to be in Sector Mode to edit sectors).  The current mode can be changed by clicking any of the mode buttons on the toolbar.

To scroll around the map either move the mouse to the edge of the screen or use the cursor keys.  The tab key provides a invaluable minimap which includes a location box showing where you are on the map.


2. Map Elements

1.1 Sectors

A map's terrain is made up from sectors.  In simple terms a sector is a 2D polygon which is assigned a texture and passable type (land, solid or water).  All maps have a base sector which is always drawn first, the base sector covers the entire map and can not be moved or deleted.

Adding a Sector

To add a sector:

Editing a Sector

To edit a sector

The sector properties are described in this table.

Floor Texture The texture to use for this sector
Passable Type The passable status of this sector (land, solid or water etc).
Bevel When set to Raised or Sunk a border is rendered around this sector during the game to give it a 3D appearance.
Water Effect Set this to true for the texture to swirl around like water.
Flow Speed For conveyors, determines how fast the sector will scroll (this is not connected to the Water Effect setting).
Flow Angle For conveyors, this is the angle which the sector scrolls.
Sector Type Set to Standard Door to make this sector a door (the passable type should be Solid).
Required Item If this sector is a door a player will need this item to open it.
Sector Hit Points This is the hit points for this sector.  If set to -1 (default) the sector can not be destroyed.
Sound Filename This option is going to be removed.
Teleport ID Match the Teleport IDs between sectors to make 2 way teleporters (-1 for none).
Roof Sector Set this to true to draw the sector last (objects will be drawn underneath).
Shadow Height Roof sectors only  - A shadow will be drawn at the sector coords + this amount (0 for none).
Draw Mode Roof sectors only - This option sets the drawing mode for this sector.
This sector is a shadow When set to true this sector is drawn as a transparent shadow and the Floor Texture will be ignored.
This sector casts a shadow When set to true a shadow will be drawn for this sector.
Casted Shadow offset When This sector cast a shadow is set to true a shadow will be drawn at the sector coords + this amount.
Use Script Trigger Set this to true to use a Script Trigger.
Trigger Text When Use Script Trigger is set to true this the code in this box will be run when a player encounters this sector, see Scripting for more help.

Note that there are additional commands on the menu which include functions to delete this sector or change its draw order.

Moving a Sector

A sector can be dragged while in Sector Mode, if you want to resize or move any of the points this will need to be done in Vertex Mode (see below).  To move a sector enter Sector Mode and simply drag the sector to the desired location.

 

1.2 Vertices

Vertices are the points on sectors.  These can be moved individually, moved in a group, added to an existing sector and deleted.

Moving Vertices

To move a vertex

To move a group of vertices (using control+click)

To move a group of vertices (using a lasso)

Adding Vertex to an Existing Sector

To add a vertex to an existing sector

Note that there are some problems with detecting the line, if you can't get the menu to appear try using a perfectly horizontal or vertical border line.

Deleting a vertex

While in vertex mode vertices can be deleted by either dragging them on top of an adjacent vertex (in the same sector) or by right clicking on a vertex and selecting Delete Vertex.


3. Advanced Map Properties

The Advanced Map Properties allow for a number of map options to be changed, most notably the title, author's details, global lighting and weather effects.

It is always good practice for 3rd party maps to contain author's name and contact information, this information could become very useful if a map gets spread around the Internet.

The map title should also be set as this is displayed both when the map is loading and in the status bar during play.

Basic Options

This table explains some of the basic settings.

Player Object Type This is the object that players will be.  By default its the standard player character but it could be any object (even a sheep!).
Map Title The map title displayed while loading the map and on the status bar during play.
Author The name of this map's author.
Author Email/Web Address Where to find the author.
Time Limit The number of minutes allowed to complete this mission.  If this time expires during play then is game over.  This option is ignored/overridden in head to head mode.

Doors

This table explains how the door options effect how the map is played.

Door Track Texture When a door is opened it becomes passable and its sector texture changed to this texture.
Door Open Sound This sound is played whenever a door is opened.

 

Weather and Lighting

This table explains how the weather and lighting values effect how the map is played.

Night Enables use of a night overlay (set to True to enable the Night Colour, Night  Density and Night Opacity settings).
Night Colour This is the colour of the night overlay, a light colour could be fog, a dark colour night or perhaps orange for dusk?
Night Density This setting determines how dark it is, the greater the value the less lights show through the night overlay.
Night Opacity This is similar to Night Density except that it does not have much effect on the lights.  You should experiment with the two values to get the combination just right.
Use Night Lights This setting determines if night lights (i.e. headlights etc) are drawn regardless of whether or not Night is enabled.

 


4 Scripting

Meteor 2 can run C based script which actually calls real functions in the game's code.

Scripting can be run one command at a time (without the need for a script file) or in C functions within a script file.

4.1 Single Command Scripting

Single command scripting is when a single function call is put directly into a sector's properties.

Please note that this is C code so it is case sensitive!

To add a single script command:

4.2 Advanced Scripting

Advanced scripting is defined as calling a blocks of script commands from a script file created by a map's author.

How it works

Each map can have its own script file, a script file has the same filename as the map except that the extension is .sc (similar to mapname.txt files for briefings).  The table below illustrates this:

Map Filename Script Filename (optional) Briefing Filename (optional)
Swallow Lake.map Swallow Lake.sc Swallow Lake.txt
foxtrot.map foxtrot.sc foxtrot.txt

Meteor looks for the script file when the map is played, if its present then it will use it.

How to Make a Script File

Script files are simply text files, any text editor can be used to work with them.  Simply create a text file with the correct name in the "base\maps" folder.

Caution: If you computer does not show file extensions then you will need to ensure that your file is not automatically named to myfilename.txt.sc!

When you have created your file you should enter this script code as a template.

Script Code Explained

The template code contains a single pre-made function called OnMapStart, you may enter a list of commands from the Script Commands List here (one per line) which are automatically called as soon as the map is played.

For example:

void OnMapStart()
{
    SC_GameMessage("Welcome to my map");
}

You can add more script commands here, lets hide some objects (note that lines starting with // are comments and are ignored by Meteor)...

void OnMapStart()
{
    SC_GameMessage("Welcome to my map");

    // hide object IDs 1 to 3 (make sure these objects exist on your map)
    SC_SetObjectHidden(1,1);
    SC_SetObjectHidden(2,1);
    SC_SetObjectHidden(2,1);
}

Now we can add another function to show the objects, we can run this code at a later time.

Add this code at the bottom of the file.

void ShowMyObjects()
{
    // show object IDs 1 to 3
    SC_SetObjectHidden(1,0);
    SC_SetObjectHidden(2,0);
    SC_SetObjectHidden(2,0);   
}

Add the code shown in bold near the top of the page to export your function (this allows Meteor to run it).

// tell M2 which functions it can use
export OnMapStart;
export ShowMyObjects;

Note the ; at the end of the line!

You can add more functions, just remember to add the export FunctionName; at the top.

How to Run a Script Function

You can run a function when the player walks over a sector.

In the Map Editor:

What to do if Your Script Does not Work

As soon as you begin your level open the game console and check for error messages from the script compiler.  If present an error message may help you to fix the problem.

If you are still stuck then you should be able to get help from the Meteor 2 Forum.


Mission Briefings and PDA Messages

Mission briefings are entries within the game's PDA (Personal Messages system).  Messages consist of a subject and message text.

There are 3 ways to display PDA messages:

  1. Create a briefing file (see below) and add a section called "OnMapStart".  This will be displayed when the map is loaded (just like in Meteor 1).
  2. Create a briefing file and add a section with your own name.  This can be added to the game PDA at any time using script (go here for PDA scripting functions).
  3. Use the SC_AddPdaMessage scripting function to add  a message directly (you type in the message).  This is only suitable for short messages.

Briefing Files

A briefing file is a text file that sits along side a map.  The filename of the briefing file must be the same as the map (except the extension is .txt).  See this table for an example.

Structure of Briefing Files

Unlike in Meteor 1, Meteor 2 briefing files are spilt into sections.  Each section contains a single briefing/PDA message (the obvious advantage being that a map can have many briefings).

This is an example of a briefing file containing two sections "OnMapStart" and "MyExtraBriefing".

 

 

 

 


Page last updated 09 September 2004

Copyright (C) 2004 by James Bunting
www.jbgames.com