
Join the
Random Map AoE2 Discord
The place where the RMS community is most active!
Also take a look at my Definitive Random Map Scripting Guide
The place where the RMS community is most active!
Also take a look at my
Random Map Scripting Links and FAQ
You recently downloaded an RMS and don’t know what to do with it? You want to design your own RMS and don’t know where to start? You’re working on an RMS and you have some questions that you want to ask? You are wondering what 'RMS' even stands for?
>
>
>
Feel free to ask any questions you might have in this thread or by starting up a new thread in the
RMS stands for
A random map script is a text file (with the extension *.rms) containing a set of instructions which are used to randomly generate a map. When you play Black Forest or Arabia, the game uses that random map script to generate a map for you to play on and it almost never looks exactly the same.
It is possible to create your own custom random map scripts and to play on ones created by other people.
The
If you are playing the CD version of the game:
If you are playing the HD Edition on Steam:
If you are locally playing a mod for the UserPatch; for example
AoC + Voobly + Wololo Kingdoms:
HD + Voobly (using the
HD + Voobly + Wololo Kingdoms:
In the lobby, choose
All you need is a text editor. Notepad will do just fine if all you want to do is look at the script or make simple edits. If you plan on spending a significant amount of time working with RM scripts, then a more advanced text editor and/or syntax highlighting will help you out. You can read about those in the
These are the types of questions that you might have if you are writing or editing RM scripts.
Take a look at the guides and tutorials in the
Perhaps you have an incomplete comment somewhere at the top of your script. Something like this for example: /* MY AWESOME MAP*/
The space is missing between MAP and */ so the whole rest of the script is ignored.
You might also have some sort of random statement that is missing
It could also be that you are missing the closing brackets
If you are playing the CD version of the game:
Go to
If you are playing the HD Edition on Steam:
Go to
If you want, you can refer to existing *.inc files to have them included in your script. Only do this with the default *inc files, because custom files will not be transferred with your script in multiplayer.
If you are using the HD Edition on Steam or the
If you do not use the HD Edition or the UP, it is still possible to test in the scenario editor, but it requires modifying the
You first need to define them using their terrain constants, like this for example:
Then you can use them like any other terrain. Lists of these terrain constants are found in the Updated New RMS Guide and also in the
#const ROAD_MOSS 39
#const ROAD_SNOW 38
This can be due to a multitude of reasons such as typos, incomplete comments, too narrow constraints on the min and max distances, or specifying a base terrain that isn’t in your map. If objects towards the end of your script are not appearing, it could be due to the excessive use of
It is like
You could add this to your
<LAND_GENERATION>
section, for example:
create_land
{
terrain_type WATER
land_percent 25
left_border 20
right_border 20
top_border 20
bottom_border 20
land_position 50 50
}
A basic way to make rivers is like this:
base_terrain WATER
create_player_lands
{
terrain_type GRASS
land_percent 100
other_zone_avoidance_distance 8
}
Closer to the center is easy: just add border attributes to your
Closer to the edge is much harder. Decreasing the
This can be due to any number of reasons. Here are a few examples:
-Using
-Attempting to use DLC objects in AoC.
-Giving the map a name that is longer than 20 characters (this bug is fixed in the HD Edition and the UserPatch).
-Using 100 as the second number for
-Using 99 as a zone number for lands
-Having a large amount of
-Having a very large number of
-Using more than 99 distinct
-Using a
As you can see, crashes can happen for all kinds of reasons – including ones not listed above. If you are experiencing crashes, comment out your entire map and then gradually uncomment the script part by part to localize the source of the crash. If you have many comments in your script, it may be simpler to start with a new blank script and copy and paste in your script part by part to localize the source of the crash. If you can’t work out why your script is crashing feel free to make a thread here and ask someone to look over it for you.
There is a bug where
This especially problematic when creating map packs!
There is a nice checklist here:
CTRL+F12
But … it doesn’t work in the HD Edition on Steam.
The sections are used in this order:
You will notice that many scripts (including the standard game scripts!) do not have them written in this order.
<PLAYER_SETUP>
<LAND_GENERATION>
<ELEVATION_GENERATION>
<CLIFF_GENERATION>
<TERRAIN_GENERATION>
<CONNECTION_GENERATION>
<OBJECTS_GENERATION>
Keep in mind that
Cliffs are placed on a special terrain. This terrain is #16 and looks exactly like GRASS. It does not have a predefined name, so you need to define it to use it or replace it.
Example:
This will replace all (or most) of your cliff grass with ice. You may want to do this on a wintry map, for example. On a desert map you may want to replace it with DESERT or DIRT if it looks out of place to have bits of grass there.
#const GRASS_CLIFFS 16
create_terrain ICE
{
base_terrain GRASS_CLIFFS
land_percent 100
number_of_clumps 99999
spacing_to_other_terrain_types 0
}
You cannot. This will NOT work:
#const NUM 10
number_of_objects NUM
You can check for any of the predefined constants from Rise of the Rajas. Constants from African Kingdoms and the Forgotten are always true, because they are listed in random_map.def for both sets of gamedata, but RoR constants are only in the expansion gamedata.
DLC_AVAILABLE will now be true if a match is launched using the expansions dataset.
if DLC_MANGROVEFOREST #define DLC_AVAILABLE endif
You are running the Wololo Kingdoms mod for the UserPatch. This replaces some of the existing
Terrain 11 (formerly dirt2) is now mangrove shallows, but you can use terrain 27 (foundation dirt) to get the same look.
Terrain 38 (formerly snow road) is now cracked dirt, but terrain 33 is now snow road, so you can use that.
Terrain 33 (formerly snow dirt) is now snow road but you can use terrain 36 (foundation snow) to get the same look.
Terrain 20 (formerly oak forest) is now mangrove forest, but you can use terrain 10 (forest) to get the same look.
Terrain 16 (formerly cliff grass) is now baobab forest, but you can use terrain 0 (grass) for the same look, or pick a new look for the cliff terrain.
Terrain 41 (formerly buggy and unused) is now acacia forest.
Example for how to deal with this:
This will make it so that
if UP_EXTENSION if DLC_MANGROVEFOREST #define WOLOLOKINGDOMS endif endif /* check the game version */
if WOLOLOKINGDOMS
#const road_type 33
#const dirt_type 36
else
#const road_type 38
#const dirt_type 33
endif
You only need to worry about this with terrains that require
If UserPatch 1.5 is the game version, then
UP_EXTENSION
will be defined, so you just do You can specify
Example:
This will assign this specific land to a random member of the second team. Note that you must have a separate create_land for every player that this map should support.
#const AT_PLAYER 0
#const AT_COLOR 1
#const AT_TEAM 2
<PLAYER_SETUP>
direct_placement
<LAND_GENERATION>
create_land
{
number_of_tiles 1000
terrain_type GRASS
assign_to AT_TEAM 2 0 0
land_position 50 80
}
You can add a
Make sure to place a king, and the map will now trigger defeat if you lose your king, even if you are in some other game mode, such as KoTH.
#const AMOUNT_GOLD 3
#const ATTR_SET 0
#const GAIA_SET_PLAYER_DATA -10
#const DATA_MODE_FLAGS 1
guard_state KING AMOUNT_GOLD 0 1 /* don't lose your king */
effect_amount GAIA_SET_PLAYER_DATA DATA_MODE_FLAGS ATTR_SET 3 /* spies + treason with regicide */
Follow these
Yes! Use the
UNIQUE_UNIT
and ELITE_UNIQUE_UNIT
definitions
#const ELITE_UNIQUE_UNIT -2
#const UNIQUE_UNIT -1
create_object UNIQUE_UNIT {
set_place_for_every_player
}
Take a look at my
If you find additional resources, please let me know!
An updated Guide that fixes errors and omissions in earlier guides and provides information about the new scripting commands available in the UserPatch and the HD Edition DLC expansions. Currently does not cover UserPatch 1.5 features yet.
A work-progress that currently covers the basics and also stuff including ZRmaps and
Well-made videos that provide lots of useful information. Also take a look at his
An unfinished, but very in-depth, look at how lands are actually generated.
Use UP 1.5 to upgrade trees and ultimately change the appearance and functionality of forests.
A guide to all the things you should check before publishing your map. Originally posted on the now defunct MrFixItOnline. Possibly worth a read if you are new to RM scripting.
Available as a
A walkthrough for creating a simple map. Also includes reference info from the RMSG (but also carries over inaccuracies from the RMSG). Was published on various now defunct sites but is still hosted
Some connection theory for you. This was originally part of Bryan's RMS Tutorial, but isn't included in the versions linked.
A tutorial about trying to make nice mountains with elevation generation.
A tutorial that guides you through learning everything there is to know about cliffs.
Learn how to get non-standard beaches in your map. Mainly useful in the Definitive Edition.
Tutorials about creating unequal starting situations using the
A tutorial in Chinese covering various advanced RMS techniques, such as moats, cliff placement, fancy forests, wall tricks, unequal starts, water elevation, etc.
Yes, you can write your script in just about any text editor, but if you pick some of these choices, you can use community-created features like syntax highlighting – which is very helpful for finding typos.
Notepad++ is free and can be downloaded here:
Shameless self-promotion, but this is one includes the pre-defined DLC constants and the UP 1.5 commands, something which the other Notepad++ options don't currently include.
An addon with syntax highlighting for free text editor Notepad++. Very comprehensive. Also available
Another addon with rms syntax highlighting for the free text editor Notepad++. Not as advanced as the one above.
PSPad is available online for free and can be downloaded here:
Quite a comprehensive package. Comes with syntax highlighting, auto-generation of code, context-sensitive help and various other useful features.
Microsoft Word is not free, but many people will have purchased it as standard office software.
Macros auto-generate a script in Word, and offers quite a bit of scope for customizing the auto-generation. Great for beginners or casual scripters.
Might be of interest to some.
Reasonably well-equipped features to auto-generate statements and check syntax.
Comes with some templates and auto-generation capabilities.
These are lists of all the objects in the game that can be created if you define them using a
Easily searchable, because it’s all in a single spreadsheet.
Much better descriptions and slightly more up-to-date than the complete list above. (This one is also "complete")
Lists the new constants from the expansions "The Forgotten" and "African Kingdoms" and "Rise of the Rajas" on Steam.
All the terrain constants with descriptions of the terrains and their functions. Might be useful if you are confused by the renaming of the terrains in the HD Edition scenario editor.
The official documentation of the new UP scripting commands.
Also see
The official documentation of the new HD Edition scripting commands. Has some typos.
Find out what you need to change to make your map WK-compatible.
Detailed look at many of the UP 1.5 features and how to use them
A collection of bits of code using the UP 1.5 features to do cool stuff.
A thread about all the commands that I found which had not been previously documented anywhere. I added those which work to the
This post was getting too long, and a lot of the resources are outdated and not really of interest these days, so I have begun relegating some of the links to this section, where they aren't lost completely, but at the same time stay out of the way of things you actually should click on.
The original guide to random map scripting, written by Ensemble Studios. Provided in the
A completely new and more concise guide that covers many of the things left out by the original RMSG. Has been significantly updated by Zetnus to produce the Updated New RMS Guide.
A rather simple tutorial that is about
This is a tutorial about the process of random map scripting, and suggested tools and resources to use, rather than talking about the actual scripting itself. Has some info about using the Steam Workshop. It's the precursor to this post that you are reading right now and I will not be keeping it up to date in the future.
An archived article with general tips for the RMS design process that contains suggestions and pitfalls to avoid. Dated, but could still worth reading.
A text editor that comes with basic script generation capabilities.
If you can read German, then you can read
Another early rms editor. You also need the
Two documents of commands and constants taken directly from the RMSG and intended to be printed out for reference.
German translation for the list of all pre-defined constants.
This is a utility that lets you generate your script in the Scenario Editor (by replacing one or two of the maps in the gamedata).
Concluding Thoughts
Hopefully this post was able to point you in the right direction; if not, feel free to ask here or make a new thread in this forum.When searching past threads, keep in mind that the AI & RM Scripting forum was only created in 2008. Older threads about RM scripting can be found by searching the

This thread was started in 2015 by
......../¯/\
......./ / / \ Check out my Blacksmith submissions as well as my Random Map Scripts.
....../ / /\\ \
...../ /_/_\\ \ Proud guardian of the Definitive Random Map Scripting Guide
..../_____\\\ \
....\\\\\\\\\\\\\/ and the Random Map Scripting Links and FAQ thread.
[This message has been edited by Zetnus (edited 08-23-2023 @ 08:04 AM).]