5.1 Creating a Singleplayer Mission

Scripting
All scripting in DR2 is done with standard text files. You can make scripts in something as simple as Notepad, but we highly recommend a good text editor, such as Multi-Edit or Ultra-Edit. Each single player mission consists of several text files, made up of configs and scripts, that relate to and depend on each other. All together, they make up the instructions that the missions follows.

By then end of this section, you will have made a playable, scripted, single player map! Although it will be very simple, it should give you a good start into the world of scripting for DR2!

Note in the following sections, these brackets [ ] are used to distinguish where the user inputs information. These brackets should not be included in your code.

Create a map to use with the tutorial in the following sections. Give the map two teams, one for the player and one for the AI (use the names 'player' and 'ai')

In the player's team setup (double-click player's team name), make sure the following buttons are highlighted: Default Team, Avail to Players, Display Stats. Permanent Radar and Requires AI should not be highlighted (note, if you are creating a mission where any of the units on that team will be controlled by a script, Requires AI should be highlighted). Also, give the players team a start location.

In the AI team's setup, make sure the following is highlighted: Display Stats, Requires AI. Default Team, Perm Radar, and Avail to Players should not be highlighted.

If you're not sure how to do any of the above, see Section 2 and Section 4

Setting Team Relations
All created teams are neutral by default. Team relations are set using a console command. The syntax is:

team.setrelation [team1] [team2] [enemy,neutral,ally]

In our case, we want the two teams to be enemies. Open the console, and enter the following two commands:

team.setrelation player ai enemy

team.setrelation ai player enemy

Then save the map.
Note that for each team, you have to set it's relation to every other team. (i.e. if you only executed the first of the two commands above, the player would be enemies with the AI, but the AI would still consider the player neutral.)