2Bit's Mapping Corner on www.PythonOnline.co.uk
ET Mapping Tutorial

Lesson 8

Topics

Creating the initial script
 
Creating the basic script
Back to main menu
Creating the basic script [Top]
Every map comes with a .script file, which is a text file found in the maps folder.

The purpose of the script is to tell the game engine some basic operational details about the map, like what the respawn times are, and to power the interesting bits of the map, like making a tank move, a balloon fire rockets, or getting constructible things to go all white/wavy and then turn into the constructed thing.

Here is a .script file for the tutorial - click here - unzip it and put the .script file into your maps (yes, maps) folder.  You'd think it would go in the scripts folder wouldn't you.  One of ET's quirks.

Associate the script suffix with Wordpad.  Rename it to <yourmap>.script if you are not using the name "tutorial".

Below is a brief explanation of its contents.  Don't worry, it's straightforward.

Scripts contain a number of separate sections, with each section handling a particular aspect of something that features in the map.  A section is given a name, and then its contents are marked out inside a pair of curly brackets, like these { }.  The naming of the sections is up to you, but the names chosen sometimes have to match the names used in the map - we'll come to that later on.

The first and only section that must appear in the script file, is called "game_manager".  It contains information about the fundamental elements of your map, as you will see below.

The game_manager section must contain a procedure named spawn, which is the procedure executed in a section when the map starts.  Each section can have a spawn procedure if you want something to happen for it when the game starts, but it isn't mandatory.

For example, the spawn procedure for a tank might make the tank start the game disabled.

Here are the contents of the script file for the tutorial map, followed by explanations.  Most of it is obvious.

game_manager

{

     
  spawn

{

   
      wm_axis_respawntime 10

wm_allied_respawntime 10

wm_set_round_timelimit 30

// Stopwatch mode defending team (0=Axis, 1=Allies)

wm_set_defending_team 0

// Winner on expiration of round timer (0=Axis, 1=Allies, -1=Nobody)

wm_setwinner 0

wait 500

setautospawn "Axis Spawn" 0

setautospawn "Allied Spawn" 1

  }    
}      
wm_axis_respawntime 10 Sets the Axis respawntime to 10 seconds.  This can be changed in the script later on if wanted, say on reaching a certain objective.
wm_allied_respawntime 10 As above, for Allies.
wm_set_round_timelimit 30 Sets how many minutes the map is to last.
wm_set_defending_team 0 For Stopwatch games, sets the initial defending team.  Wherever a team is referenced in the script, 0 means Axis and 1 means Allied
wm_setwinner 0 If the map timer expires, the winning team is declared to be team 0, ie the Axis.
wait 500 Wait 500 milliseconds, to allow the other game components to start up, so that they can be safely referenced
setautospawn "Axis Spawn" 0 Tells the game where the Axis players should spawn by default.  In the tutorial map, the yellow team_wolf_objective box for the Axis team has a description (visible if you select the box and press N) called "Axis Spawn".  This is what is being referenced in the script.
setautospawn "Allied Spawn" 1   Likewise for the Allies.
T

he handy thing about having at least this much script in place is that it can set the respawntime to 10 secs, making your testing easier.

 As you will have guessed, lines that have // in them are treated as comments from that point to the end of the line.

Next lesson