Common RMS mistakes and how to fix them

Most RMS bugs are silent. The game does not show an error. It simply builds a map that is wrong in some way. These problems all came up while building the tools on this site, and each one was checked against the official scripts or in the game itself.

An object never appears

Symptom: your script looks correct, but the objects are not on the map.

Cause: the name is not defined. Some names are built into the engine's definitions, including GOLD, STONE, RELIC, SHEEP and DEER. Others exist only because a script or include defines them with #const, for example STRAGGLER, FISH_A and PREDATOR_A. If you use one of those names without defining it, nothing is placed and no warning appears.

Fix: add the #const line yourself, or include the file that defines it.

Your #const override does nothing

Cause: the first definition of a #const wins. If an include has already set the name, a later line is ignored.

Fix: put overrides at the top, before #include_drs includes/themes.inc. Official maps such as Dingos use this pattern.

Players start with 6 villagers instead of 3

Cause: a duplicate land_id. Objects placed with place_on_specific_land_id go on each land with that id. So two lands sharing an id get two sets of objects.

Fix: give every land its own id unless you really do want the objects repeated.

Town Centers land in random places

Symptom: terrain looks right, but players ignore their positions.

Cause 1: a land_id on a player land. This disables set_place_for_every_player, so the shared includes cannot find the start.

Cause 2: a large other_zone_avoidance_distance on a map made from many small lands. The value pushes a land away from lands in other zones, and any land without a zone counts as another zone. When the rule cannot be met, the engine relaxes it and the start moves. Rampart can use 14 because its only lands are the spawns. Pilgrims mixes spawns with terrain lands and uses 2.

Fix: no land_id on player lands, use direct_placement with land_position, and keep the avoidance value small.

Objects spread across the whole map

Cause: place_on_specific_land_id alone does not confine objects to the land. Without a further limit, they can be placed anywhere connected to it.

Fix: add avoid_other_land_zones. Add find_closest if you want an object at the land's origin.

Lands move away from where you put them

Cause: land bases that are not player lands will not overlap each other, so the engine pushes one away. Also, base_size sets the minimum distance from the map edge.

Fix: keep land bases apart, and use a small base_size for lands near the edge.

The script fails after you nest random blocks

Cause: start_random cannot go inside another start_random.

Fix: define a flag in the first block, then use if around a separate second block.

override_map_size seems ignored

Cause: includes/scaling.inc calls the same command with the lobby size.

Fix: put your own call after that include.

Wrong map size names

The names in scripts do not match the names in the lobby. The lobby's Normal size is LARGE_MAP in a script, and the lobby's Large size is HUGE_MAP. Test at the actual size you plan to play.

Sheep or deer are missing on a biome

Cause: some biomes define animals as groups, which only exist after includes/object_groups.inc has loaded. Also, some biomes do not have every animal type. The desert theme has no small huntable animal, for example.

Fix: load that include, or set the animals by number before themes.inc.

How to test faster

  • Change one thing at a time. A silent bug is hard to find after ten changes.
  • Test the smallest and largest map sizes you plan to support.
  • Test with a full lobby. A script that works for 2 players can run out of space with 8.
  • Generate several times, since a bug may only appear on one random branch.

New to scripting? Start with how random map scripts work.