3.2 Attributes
procedure
Mutually exclusive with: grouped-by-team
Game versions: All
Players are positioned in a circle with some variation. This is the default, and will apply even if you do not type it.
procedure
(grouped-by-team) → void?
Mutually exclusive with: random-placement
Game versions: UP/HD/DE
Requires: Team Together box ticked in the lobby (on by default)
Players of the same team are positioned in close proximity to each other. Distance between team members is double the base-size used in create-player-lands.
procedure
Game versions: UP/DE
Allows the land-position attribute in create-land to be used in combination with the assign-to-player or assign-to attributes to individually position players at exact positions on the map.
On UP, !P will be appended to the map name in the objectives window.
On UP, it can be used in combination with random-placement / grouped-by-team but it only works when using land-position
On DE, it disables random-placement and grouped-by-team, but doesn’t necessarily require land-position - it is possible to just specify borders instead. If used with create-player-lands, these lands will be positioned entirely at random (ignoring the normal circular positioning), so this is usually not desirable.
#lang aoe2-rms <PLAYER-SETUP> (direct-placement) <LAND-GENERATION> (create-land (terrain-type 'DESERT) (land-percent 3) (land-position 50 50) (assign-to-player 1))
procedure
(nomad-resources) → void?
Game versions: UP/HD/DE
In DE, this adds the actual cost of a town center for the player’s civilization. ie. Incas only get an extra 85 stone.
procedure
Game versions: DE only
Activates a treaty period on nomad maps which lasts until every player has completed a town center or until 5 min have elapsed, whichever occurs first. Nomad treaty prevents combat and prevents construction within 10 tiles of another player’s town center (foundation).
The border of the 10 tile radius is visible in explored tiles, which makes finding enemy town centers much easier. For this reason, nomad maps for tournament games often intentionally choose not to have a nomad treaty, while instead having rules against early villager fighting.
procedure
(behavior-version version-number) → void?
version-number : any/c
Game versions: DE only
Arguments:
- version-number - number (0-2) (default: 0)
0 is classic behavior, and is the default
1 is new behavior
2 supposedly changes the behavior of object placement for per-player lands, but there have been no observed or noticeable differences
Used for versioning changes that might affect how existing maps generate. Changes land generation such that when specifying number-of-tiles or land-percent, the square amount covered by the base-size is included in the total, rather than being additive. Also fixes a bug where land order would influence the generation.
This command can be used anywhere in your script. Player setup seems like an appropriate place to put it, so it is listed here.
May be used in the future to gate off more fixes and changes that might break backwards compatibility.
- To update an old map, you must increase number-of-tiles by (1+base-size*2)² to get the same number of tiles as you previously had.
You also should increase any sub-100 land-percent by an amount that varies with map size.
#lang aoe2-rms (behavior-version 1) <LAND-GENERATION> (create-player-lands (terrain-type 'DLC_BLACK) (number-of-tiles 250) (base-size 12))
procedure
(override-map-size side-length) → void?
side-length : any/c
Game versions: DE only
Arguments:
- side-length - number (36-480) (default: use size set in lobby) (see: Map sizes)
values smaller than 36 or larger than 480 will clamp to those limits
Only one argument is accepted, so you are still restricted to square maps.
This command can be used anywhere in your script. For general usage it should be used prior to any land generation, which is why it is listed here.
Affects the scaling of elevation (set-scale-by-size / set-scale-by-groups), terrains (set-scale-by-size / set-scale-by-groups), and objects (set-scaling-to-map-size).
Can theoretically be used multiple times. Land generation will be based on what the current size is at that point in the script.
- Does not influence the length of the wonder timer; it will only depend on the size set in the lobby.
This can be used to reduce the wonder timer in 8 player games, by having players choose the tiny size in the lobby for a script that overrides the size to something suitable for 8 players.
#lang aoe2-rms (override-map-size 100)
#lang aoe2-rms (%cond ['TINY_MAP (override-map-size 144)] ['SMALL_MAP (override-map-size 168)] ['MEDIUM_MAP (override-map-size 200)] ['LARGE_MAP (override-map-size 220)] ['HUGE_MAP (override-map-size 240)] ['GIGANTIC_MAP (override-map-size 255)])
procedure
Game versions: All
Scales number-of-tiles to the map size. Unscaled value refers to a 100x100 map (see: Map Sizes for the scaling table).
If you see a script scaling by both size and groups, only the final attribute will apply!
If you want to scale by both groups and size, use set-scale-by-groups instead.
In <ELEVATION-GENERATION>, if you want to scale elevation by both groups and size, you must do so manually using Conditionals.
BUG (AoC/UP/HD): the behavior of set-scale-by-size and set-scale-by-groups is inverted, with each attribute scaling elevation as the other one should. This bug is fixed in DE.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 3 (base-terrain 'GRASS) (number-of-tiles 400) (number-of-clumps 4) (set-scale-by-size))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'WATER (base-terrain 'GRASS) (number-of-tiles 400) (number-of-clumps 4) (set-scale-by-size))
procedure
Game versions: All
Mutually exclusive with: set-scale-by-size
Scales number-of-clumps to the map size. Unscaled value refers to a 100x100 map (see: Map Sizes for the scaling table).
If you see a script scaling by both size and groups, only the final attribute will apply!.
In <TERRAIN-GENERATION>, when used with number-of-tiles, the total tiles are also scaled to map size as well.
In <ELEVATION-GENERATION>, unlike for terrains, for elevation this attribute does NOT increase the total tile count, If you want to scale elevation by both groups and size, you must do so manually using Conditionals.
BUG (AoC/UP/HD): the behavior of set-scale-by-size and set-scale-by-groups is inverted, with each attribute scaling elevation as the other one should. This bug is fixed in DE.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 4 (base-terrain 'GRASS) (number-of-tiles 400) (number-of-clumps 4) (set-scale-by-groups))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'WATER (base-terrain 'GRASS) (number-of-tiles 400) (number-of-clumps 4) (set-scale-by-groups))
Game versions: All
amount - number (1+) (default: 1 - no spacing)
Number of tiles between each elevation level. Numbers larger than 1 will produce rings of flat terrain on each level of a hill.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'GRASS) (number-of-tiles 3000) (spacing 4))
procedure
Game versions: DE only
Removes the bias of hill placement towards the bottom (south) of the map. Default is disabled, so you should always include this attribute! Elevation will still be slightly biased towards the south, even with this attribute. See Balanced Elevation Comparison in the Appendix for a comparison with and without this attribute.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'GRASS) (number-of-tiles 9320) (number-of-clumps 9320) (enable-balanced-elevation)) <TERRAIN-GENERATION> (create-terrain 'DESERT (base-terrain 'GRASS) (land-percent 100) (number-of-clumps 9320) (height-limits 1 7))
procedure
(set-gaia-civilization civ-number) → void?
civ-number : any/c
Game versions: DE only
Arguments:
civ-number - number (0-53) (default: 0 - gaia) (see: Civilizations)
Set the civilization for gaia to use. This will affect the architectural style of any gaia buildings, and the appearance of any units that have regional variations. It will also affect any civilization bonuses, upgrades and unique technologies (relevant especially for battle royale)
The default gaia civ in DE uses the western European architectural style.
This command can be used anywhere in your script. Player setup seems like an appropriate place to put it, so I have listed it here.
If used, gaia effects (see: Effect Constants) will no longer function when applied to units that can be player controlled.
If used, gaia buildings with make-indestrucible will be burning, so it is best not to use set-gaia-civilization if you wish to use indestructible gaia buildings.
If used multiple times, only the final instance will apply.
Does not work in the scenario editor.
#lang aoe2-rms (set-gaia-civilization 35) <OBJECTS-GENERATION> (create-object 'MONUMENT)
procedure
(ai-info-map-type map-type nomad? michi? show-type) → void? map-type : any/c nomad? : any/c michi? : any/c show-type : any/c
Game versions: All
- map-type - map type constant (see: Map Types) (default: CUSTOM)
Specify a standard map type that your map is similar to.
- nomad? - boolean (1 or 0) (default: 0)
Specify if your map is nomad style (no town center to start with).
Always use this on nomad starts since it prevents issues where ally locations are revealed (fixed in DE)
- michi? - boolean (1 or 0) (default: 0)
Specify if your map is Michi style (forest completely separating players).
- show-type - boolean (1 or 0) (default: 0)
Specify if you want your chosen map type to be shown in the objectives window (only works in UP)
Provide information about the map to AIs. If your map is not very similar to an existing map, it is best to leave out the command entirely, or to use CUSTOM as the map type.
#lang aoe2-rms <PLAYER-SETUP> (ai-info-map-type 'ARABIA 0 0 1)
procedure
(effect-amount effect-type type attribute-type amount) → void? effect-type : any/c type : any/c attribute-type : any/c amount : any/c
Game versions: UP/DE
effect-type - effect constant (see: Effect Constants)
type - object/resource/technology/effect constant (see: Objects, Resource Constants, Technology Constants, Miscellaneous Constants, Class Constants, Advanced Genie Editor)
attribute-type - attribute constant (see: Attribute Constants)
- amount - number
DE only: accepts floating-point values
Modify various aspects of the gamedata, specifically for your map. See the linked guides for a better overview of the possibilities.
When modifying objects, you may need to target ALL hidden variations, one-by-one.
If an object ends up with more than 32767 hitpoints, it is instantly destroyed. Be sure to consider in-game upgrades and civ bonuses.
If you disable an object with this command, in-game techs/ages (unless disabled) may re-enable it. The civ tech tree may also override changes. (UP only) !C will be appended to the map name in the Objectives window.
In vanilla UP only, the relevant constants must first be defined before use.
#lang aoe2-rms <PLAYER-SETUP> (effect-amount 'MOD_RESOURCE 'AMOUNT_STARTING_FOOD 'ATTR_ADD 10000)
#lang aoe2-rms <PLAYER-SETUP> (effect-amount 'SET_ATTRIBUTE 'HOUSE 'ATTR_STORAGE_VALUE 10) (effect-amount 'SET_ATTRIBUTE 'HOUSE_F 'ATTR_STORAGE_VALUE 15) (effect-amount 'SET_ATTRIBUTE 'HOUSE_C 'ATTR_STORAGE_VALUE 20) (effect-amount 'SET_ATTRIBUTE 'HOUSE_I 'ATTR_STORAGE_VALUE 25)
procedure
(effect-percent effect-type type attribute-type percentage) → void? effect-type : any/c type : any/c attribute-type : any/c percentage : any/c
Game versions: UP/DE
effect-type - effect constant (see: Effect Constants)
type - object/resource/technology/effect constant (see: Objects, Resource Constants, Technology Constants, Miscellaneous Constants, Class Constants, Advanced Genie Editor)
attribute-type - attribute constant (see: Attribute Constants)
- percentage - number
DE only: accepts floating-point values
Same as effect-amount but allows for greater precision. The specified value is divided by 100 so that you can use decimal values.
#lang aoe2-rms <PLAYER-SETUP> (effect-percent 'ADD_RESOURCE 'VILLAGER_CLASS 'ATTR_MOVE_SPEED 30)
procedure
(guard-state object-type resource-type resource-delta flags) → void? object-type : any/c resource-type : any/c resource-delta : any/c flags : any/c
Game versions: UP/DE
object-type - object constant or class constant (see: Objects, Class Constants) for villagers use VILLAGER_CLASS instead of VILLAGER
resource-type - resource amount constant (see: Resource Constants)
- resource-delta - number (default: 0)
DE only: accepts floating-point values
- flags - number (0-7) (default: 0)
0: no flags
1: lose if you do not control the specified object-type
2: activate a resource trickle of the resource-type at the level of resource-delta/100, as long as you control object-type
4: invert the object-type requirement for the other flags
add the values to apply multiple flags
Only one guard-state command can be active in your script!
(UP only) If used, !G will be appended to the map name in the Objectives window, along with the guard state details
#lang aoe2-rms <PLAYER-SETUP> (guard-state 'KING 'AMOUNT_GOLD 0 1)
#lang aoe2-rms <PLAYER-SETUP> (guard-state 'MONUMENT 'AMOUNT_FOOD -5 6)
#lang aoe2-rms <PLAYER-SETUP> (guard-state 'VILLAGER_CLASS 'AMOUNT_GOLD 10 3)
procedure
(terrain-state mode parameter1 parameter2 flags) → void? mode : any/c parameter1 : any/c parameter2 : any/c flags : any/c
Game versions: UP only
mode - number (0) (default: 0)
parameter1 - number (0) (default: 0)
parameter2 - number (0) (default: 0)
- flags - number (0-7) (default: 0)
0: no flags
1: enable building on shallows; also allows resources to be placed on shallows
2: thinner blending of shallows and beach terrain
4: changes ice blending to use shallows-style blending
add the values to apply multiple flags
Changes the shallows terrain to allow it to be buildable. Can also be used to modify shallows and ice blending properties. There may be further unknown and undocumented functionality.
Parameters 1 and 2 are unimplemented as far as we currently know, and the only known mode is 0, so just set the first three numbers to 0 if you use this command.
#lang aoe2-rms <PLAYER-SETUP> (terrain-state 0 0 0 7)
procedure
(weather-type precipitation-style live-color fog-color water-direction) → void? precipitation-style : any/c live-color : any/c fog-color : any/c water-direction : any/c
Game versions: UP only
- precipitation-style - number (-4 to 4) (default: 0)
0: no precipitation
2: rain
3: thunderstorm
4: snow
Precipitation goes west to east; use negative numbers for east to west.
- live-color - number (0 to 255) (default: 0)
Color of terrain tinting in revealed areas.
0: none; 1-255 refers to the color palette.
- fog-color - number (0 to 255) (default: 0)
Color of terrain tinting in the fog of war.
0: none; 1-255 refers to the color palette.
- water-direction - number (-1 to 1) (default: 0)
Direction of animated water.
0: random; 1: west to east; -1: east to west.
Set up precipitation and terrain tinting.
It usually looks good to match the precipitation and water direction.
It often makes sense to pick similar colors for live and fog tinting.
Terrain tinting looks bad on streams and recordings, so you may want to leave it out.
In DE, consider using color-correction instead.
#lang aoe2-rms <PLAYER-SETUP> (weather-type -3 16 0 -1)
procedure
(water-definition type) → void?
type : any/c
Game versions: DE only
See also: color-correction, enable-waves
Arguments:
type - water color correction constant (see: Water Types) (default: 0 (sunny daytime))
Specify a water profile to apply on your map. Each option applies different color correction, waves and reflections to 3D water. Not visible if the "Render 3D Water" setting is disabled. on UP, use weather-type instead.
procedure
(base-terrain terrain-type) → void?
terrain-type : any/c
Sections: <TERRAIN-GENERATION>.
Game versions: All
terrain-type - terrain constant (see: Terrains) (default: GRASS)
BUG (DE): Does not default to GRASS, so make sure to specify the base terrain.
In <LAND-GENERATION>, specifies a terrain to initially fill the map. Maps with rivers going through them or oceans on the outside usually use water. Maps with forest on the outside usually use forest terrain.
In <ELEVATION-GENERATION>, terrains on which the hill(s) should generate. If you have multiple terrains you want hills on, then you need multiple create-elevation blocks.
Note that you only need to consider terrains from <LAND-GENERATION>, as <TERRAIN-GENERATION> occurs after elevation has already been placed.
In <TERRAIN-GENERATION>, specifies the base terrain on which you want to place your new terrain.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER)
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'WATER) (number-of-tiles 600))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'FOREST (base-terrain 'GRASS) (land-percent 10)) (create-terrain 'WATER (base-terrain 'FOREST))
procedure
(base-layer terrain-type) → void?
terrain-type : any/c
Sections: <TERRAIN-GENERATION>, <LAND-GENERATION>.
Game versions: DE only
Accepts a terrain constant. See Terrains.
Defaults to no layered terrain.
In <TERRAIN-GENERATION> and <LAND-GENERATION>, specify a terrain to layer on top of the map’s base-terrain. This layered terrain is visual only, and does not confer any terrain properties or object restrictions.
Must be used AFTER base-terrain.
If used, you must specify the same base-layer in create-elevation if you want to generate elevation on the map base terrain.
In <ELEVATION-GENERATION>, use this attribute in addition to base-terrain if (and only if) you specified a layer for the map base terrain at the beginning of <LAND-GENERATION>.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'DIRT3) (base-layer 'SNOW)
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'DIRT) (base-layer 'SNOW) <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'DIRT3) (base-layer 'SNOW) (number-of-tiles 9320) (number-of-clumps 20))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'DESERT (base-terrain 'GRASS) (land-percent 10) (terrain-mask 1)) (create-terrain 'WATER (base-layer 'DESERT))
procedure
(beach-terrain type) → void
type : any/c
Game versions: DE only
Arguments: type - terrain constant (see: Terrains) (default: BEACH)
Specify a terrain that should be placed where the current terrain borders water.
If a non-beach terrain is specified, players will not be able to build docks on this coastline.
If a water terrain is specified, it will fully replace the terrain specified in create-terrain, so this is NOT recommended.
BUG: beach-terrain does not work when a <CONNECTION-GENERATION> section is present.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) <TERRAIN-GENERATION> (create-terrain 'DIRT (number-of-tiles 500) (spacing-to-other-terrain-types 1) (base-terrain 'WATER) (beach-terrain 'DLC_BEACH2))
procedure
(enable-waves show-waves) → void?
show-waves : any/c
Game versions: DE only
show-waves - boolean (1 or 0) (default: 1)
Enabled by default, so you only need to include it if you want to disable animated beach waves on your map. Waves are only visible if the player has "Render Beach Waves" turned on in the game settings.
procedure
(terrain-mask layer) → void?
layer : any/c
Game versions: DE only
Arguments:
layer - number (1, 2) (default: 0 - no masking)
1 - new terrain is masked over the base terrain and inherits its properties.
2 - new terrain is masked under the base terrain and provides new properties.
Enables terrain masking/layering for the terrain being created. Terrain inherits all properties, placement restrictions, automatic objects (such as trees for forest terrains), minimap color, etc. from the terrain underneath (i.e., base-terrain when masking over, or create-terrain when masking under).
Terrain masking is a great way to blend terrains in a realistic and visually appealing manner.
Masking layers 1 and 2 have different visual masking patterns.
Terrain will have animated water if ANY of the component terrains are water.
Legacy terrains that are already a blend of two texture files cannot be visually masked. They will contribute fully to the appearance of the final terrain. These terrains are: GRASS_SNOW, DIRT_SNOW, [dirt snow foundation], DLC_MOORLAND, DLC_JUNGLELEAVES, [road snow], [road fungus], DLC_DRYROAD, DLC_JUNGLEROAD, DLC_ROADGRAVEL.
There are also some special cases with beach terrains, which may not always mask as expected (potentially a bug).
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'SNOW (base-terrain 'GRASS) (land-percent 50) (terrain-mask 1))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'SNOW (base-terrain 'GRASS) (land-percent 50) (terrain-mask 2))
procedure
(spacing-to-other-terrain-types distance) → void
distance : any/c
Game versions: All
Arguments:
distance - number (default: 0)
Minimum distance that this terrain will stay away from other terrain types. Only considers existing terrains at the time of generation — terrains generated later will need their own spacing. Terrains will not stay away from the same terrain type created previously. This requires the use of an intermediate placeholder terrain. Also affects the distance that the terrain will stay away from cliffs (because cliffs generate their own terrain underneath them — terrain 16). When used with set-flat-terrain-only, it also affects the distance that the terrain will stay away from slopes.
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'WATER (base-terrain 'GRASS) (land-percent 10)) (create-terrain 'FOREST (base-terrain 'GRASS) (spacing-to-other-terrain-types 10) (land-percent 100))
procedure
(spacing-to-specific-terrain type distance) → void?
type : any/c distance : any/c
Game versions: DE only.
Arguments:
type - terrain constants (see: Terrains)
distance - number (default: 0)
Minimum distance that this terrain will stay away from a specific terrain.
Can be used multiple times to avoid multiple terrain types.
Only considers existing terrains at the time of generation - terrains generated later will need their own spacing.
Cannot be used to avoid the terrain currently being placed. Doing this will prevent the terrain from being placed at all.
spacing-to-other-terrain-types takes precendence if larger.
Example: Generate forest that stays away from various terrains.
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'FOREST (base-terrain 'GRASS) (land-percent 20) (number-of-clumps 30) (spacing-to-specific-terrain 'WATER 15) (spacing-to-specific-terrain 'SHALLOW 8) (spacing-to-specific-terrain 'ICE 6) (spacing-to-specific-terrain 'DESERT 3))
procedure
Game versions: All
Requires: spacing-to-other-terrain-types > 0.
The terrain will avoid sloped tiles by the distance specified in spacing-to-other-terrain-types. Only works when a distance of at least 1 has been specified.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'GRASS) (number-of-tiles 3000) (number-of-clumps 1)) <TERRAIN-GENERATION> (create-terrain 'DESERT (base-terrain 'GRASS) (land-percent 10) (number-of-clumps 9320) (spacing-to-other-terrain-types 1) (set-flat-terrain-only))
procedure
(terrain-type type) → void?
type : any/c
Game versions: All
type - terrain constant (see: Terrains) (default: GRASS)
Specify which terrain the land should have.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DIRT) (land-percent 20))
procedure
(land-percent percentage) → void?
percentage : any/c
Game versions: All
Mutually exclusive with: number-of-tiles
In <LAND-GENERATION>, percentage of the total map that the land should grow to cover. If land growth is constrained by borders or other lands, lands may be smaller than specified. For player lands (create-player-lands) the percentage is divided equally between all players. Valid values are 0 - 100, inclusive, defaults to 100.
In <TERRAIN-GENERATION>, percentage of the total map allocated to given command. If number-of-clumps is specified, this value is divided equally among the clumps. Terrain will only be replaced where the appropriate base-terrain or base-layer is present, and will only replace the specified number of individual clumps, so it will not necessarily fill 100% of the map if set to 100.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DIRT) (land-percent 20))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'DESERT (base-terrain 'GRASS) (land-percent 50))
procedure
(number-of-tiles amount) → void?
amount : any/c
Game versions: All
Mutually exclusive with: land-percent
In <LAND-GENERATION>, can specify the fixed number of tiles that the land should grow by, default being the entire land.
Total size of the land is number-of-tiles in addition to the square origin specified by base-size.
When using behavior-version 1, the square origin is included in the total number-of-tiles, resulting in smaller lands, unless compensated for.
For player lands (create-player-lands) each player is given the specified number of tiles.
In <ELEVATION-GENERATION> or <TERRAIN-GENERATION>, specifies total base tile count, defaulting to 120 on tiny maps. If number-of-clumps is specified, this value is divided equally among the clumps.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DIRT) (number-of-tiles 300))
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'GRASS) (number-of-tiles 600))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'WATER (base-terrain 'GRASS) (number-of-tiles 500))
procedure
(number-of-clumps amount) → void?
amount : any/c
Game versions: All
Amount - number (default: 1)
A maximum of 9320 should be used when also specifying set-scale-by-groups.
Number of individual terrain patches to create.
If clumps are larger than expected (or total count is lower than expected), several adjacent clumps have merged.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 3 (base-terrain 'GRASS) (number-of-tiles 400) (number-of-clumps 4))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'FOREST (base-terrain 'GRASS) (land-percent 20) (number-of-clumps 40))
procedure
(cliff-type type) → void?
type : any/c
Game versions: DE only
Arguments: cliff-type - cliff type constant (see: Cliff Types) (default: gray granite cliffs)
Choose the color of the cliffs to match the theme of your map.
Currently the following are available:
CT_GRANITE
CT_DESERT
CT_SNOW
CT_MARBLE
CT_LIMESTONE
#lang aoe2-rms <CLIFF-GENERATION> (cliff-type 'CT_DESERT)
procedure
(min-number-of-cliffs amount) → void?
amount : any/c (max-number-of-cliffs amount) → void? amount : any/c
Game versions: All
Arguments: amount - number (default: min=3, max=8)
Set the minimum number of distinct cliffs to create.
The actual number of cliffs is chosen at random from between min (inclusive) and max (exclusive).
Does not scale with map size, so you must do so manually using Conditionals.
Make sure min does not exceed max.
procedure
(min-length-of-cliff length) → void?
length : any/c (max-length-of-cliff length) → void? length : any/c
Game versions: All
Arguments: length - number (3+) (default: min=5, max=9)
Sets the minimum length of a cliff, in cliff segments.
Cliff lengths are chosen at random from between min and max (inclusive).
The unit is NOT tiles, but "cliff segments": length 3 = 12 tiles, 4 = 15 tiles, 5 = 18 tiles, etc.
Minimum must be at least 3 for cliffs to appear at all.
Cliffs may end up shorter than expected if they run out of space.
Make sure min does not exceed max, otherwise the game will crash.
#lang aoe2-rms <CLIFF-GENERATION> (min-number-of-cliffs 10) (max-number-of-cliffs 10) (min-length-of-cliff 3) (max-length-of-cliff 5)
procedure
(cliff-curliness percentage) → void?
percentage : any/c
Game versions: All
Arguments: percentage - number (0-100) (default: 36)
The chance that a cliff changes direction at each segment. Use low values for straight cliffs and high values for curly cliffs.
#lang aoe2-rms <CLIFF-GENERATION> (min-number-of-cliffs 10) (max-number-of-cliffs 10) (min-length-of-cliff 10) (max-length-of-cliff 10) (cliff-curliness 50)
procedure
(min-distance-cliffs distance) → void?
distance : any/c
Game versions: All
Arguments: distance - number (default: 2)
Minimum distance in "cliff units" between separate cliffs. 0 is 0 tiles, 1 is 3 tiles, 2 is 6 tiles, etc.
#lang aoe2-rms <CLIFF-GENERATION> (min-number-of-cliffs 9999) (max-number-of-cliffs 9999) (min-distance-cliffs 1)
procedure
(min-terrain-distance distance) → void?
distance : any/c
Game versions: All
Arguments: distance - number (default: 2)
Minimum distance in "cliff units" that cliffs will avoid water terrains by. 0 is 0 tiles, 1 is 3 tiles, 2 is 6 tiles, etc.. Note that this only considers terrains from <LAND-GENERATION>, as <TERRAIN-GENERATION> occurs after cliffs have already been placed.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'GRASS) (land-percent 100) (other-zone-avoidance-distance 10)) <CLIFF-GENERATION> (min-number-of-cliffs 9999) (max-number-of-cliffs 9999) (min-distance-cliffs 0) (min-terrain-distance 1)
Game versions: All
radius - number (default: 3)
Square radius of the initially placed land origin, before any growth.
The default of 3 results in a 7x7 land origin (49 tiles total).
base-size will produce a perfect square if used with land-percent 0 or number-of-tiles 0.
base-size is the minimum distance that a land will be placed from the edge of the map.
Land bases are placed sequentially, so if they are large and overlap, the land placed last will be the one visible in the overlapping region.
Non-player land bases will not overlap with each other, unless...
If base-size for non-player lands is too large, the land will fail to find a valid position and will be placed at the center of the map, overlapping any other lands at the center.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'ICE) (base-size 6) (number-of-tiles 0))
procedure
Game versions: All
The square land origin becomes a circle of the size that would be exactly inscribed by the square.
Land origins with a base-size of 3 or smaller will still be a perfect square, while larger bases will be more obviously circular. Can be used to produce a perfect circle if combined with land-percent 0 or number-of-tiles 0.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DESERT) (land-percent 0) (base-size 12) (set-circular-base))
procedure
(generate-mode mode) → void?
mode : any/c
Game versions: DE only
Arguments:
mode - boolean (1 or 0) (default: 0 - lands are not placed in corners)
By default, lands are positioned at random in a cross-shaped area, and will never be in the corners. Setting the generate mode to 1 will allow lands to be randomly positioned anywhere, including the corners.
No effect for create-player-lands.
No effect when using assign-to-player or assign-to for create-land, unless direct-placement is specified in <PLAYER-SETUP>.
Example: Create 4 ponds that can appear anywhere, including the corners.
#lang aoe2-rms <LAND-GENERATION> (create-land (generate-mode 1) (terrain-type 'WATER) (land-percent 1)) (create-land (generate-mode 1) (terrain-type 'WATER) (land-percent 1)) (create-land (generate-mode 1) (terrain-type 'WATER) (land-percent 1))
procedure
(land-position percentage-x percentage-y) → void?
percentage-x : any/c percentage-y : any/c
Game versions: All
percentage-x - number (0-100) (default: random*) X is the axis running from the top (southwest) to the bottom (northeast)
percentage-y - number (0-99) (default: random*) Y is the axis running from the left (northwest) to right (southeast)
* Lands without land-position will have their randomly chosen origin in a cross-shaped area and will never be in the corners.
Specify the exact origin point for a land, as a percentage of total map dimensions.
land-position 50 50 is the center of the map.
land-position 0 0 is the west corner, 100 99 is the east corner, 100 0 is the north corner, 0 99 is the south corner.
Ignores border restrictions.
If placed outside of specified borders, the land will not grow beyond its base-size.
Disabled for create-player-lands.
Disabled when using assign-to-player or assign-to for create-land, unless direct-placement is specified in <PLAYER-SETUP>.
Positions outside of the map can theoretically be used if the crash conditions are avoid?ed.
Note: 100 for the Y coordinate (or anything outside the map) will crash the game if your map uses <CONNECTION-GENERATION> and has a connection that needs to reach this land specifically, or if the land uses assign-to-player.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'WATER) (land-percent 10) (land-position 50 50))
procedure
(circle-radius radius variance) → void?
radius : any/c variance : any/c
Game versions: DE only
External reference: Official DE Documentation
radius - number (1-50) It is a percentage of map width. 0 will disable circle-radius. The standard radius for unconstrained lands is around 40. Values larger than 50 will tend to force players towards the extreme edges and corners of the map.
variance - number (default: 0) 0 is a perfect circle with no variance. 20 seems to be close to the standard amount of variance when not using circle-radius. Very large values will tend to force players towards the corners of the map. Each player will vary independent of the others.
Used in create-player-lands to position the player lands in a circle with equal distance to the center, with specified variance.
circle-radius ignores any specified borders when placing the land origins, but land growth will still be constrained by borders.
There is also a command called circle-placement which is used in the standard maps and listed in the official documentation. That command is non-functional.
If used for multiple unique create-player-lands commands, only the final radius will apply.
BUG: if used for multiple player lands while also using grouped-by-team, the additional land positions will not generate properly.
If used for create-land, it will still apply to player lands normally.
See Circle Radius Comparison in the appendix for a comparison of not using circle-radius to a radius with no variance.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DIRT) (number-of-tiles 100) (circle-radius 20 0))
procedure
(left-border percentage) → void?
percentage : any/c (right-border percentage) → void? percentage : any/c (top-border percentage) → void? percentage : any/c (bottom-border percentage) → void? percentage : any/c
Game versions: All
percentage - number (0-99) (default: 0)
Specify a percentage of map width for land placement and growth to stay away from the given border.
Left is southwest; right is northeast, top is northwest; bottom is southeast.
There is a hard-coded feature that makes lands look like octagons instead of squares when constrained by borders.
Borders shift the entire circle of all the player lands.
You cannot have multiple rings of player lands with different borders; they will all be in the same circle.
Due to rounding, the exact number of tiles that a given percentage value corresponds to may not be the same for each side. For example, to stop 2 tiles from the edge on a tiny (120x120) map, a value of 2 must be used for the top and left borders, but a value of 3 is needed for the bottom and right borders.
Specify a land-position within the map
Specify a sufficiently large base-size (this may require manually scaling of base-size with map size)
BUG: asymmetric borders for player lands can cause issues when the top-border is larger than other borders (External reference: RMS Border Bugs Exposed). Avoid? this by always using another border along with top-border when creating player lands.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DIRT) (land-percent 100) (bottom-border 60) (left-border 60))
procedure
(border-fuzziness border-adherence) → void?
border-adherence : any/c
Game versions: All
border-adherence - number (0-100) (default: 20)
Specifies the extent to which land growth respects borders and actually stops at a border.
Low values allow lands to exceed specified borders, giving ragged looking edges when land is constrained by borders.
0 causes land growth to ignore borders entirely.
100 (or any negative value) means that borders are fully respected, resulting in perfectly straight lands along borders.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'DESERT) (land-position 50 50) (land-percent 100) (left-border 40) (right-border 40) (top-border 40) (bottom-border 40) (border-fuzziness 2))
procedure
(clumping-factor factor) → void?
factor : any/c
Game versions: All
In <LAND-GENERATION>, defaults to 8, useful range being about 0-40. The extent to which land growth prefers to clump together near existing tiles. Moderate values (11-40) create rounder lands, while low values (0-10) create more irregular lands, and high values (40+) create lands that extend in one direction away from the origin. Negative values create extremely snakey lands, and are generally not recommended.
In <TERRAIN-GENERATION>, defaults to 20, useful range being about 0-25. The extent to which terrain tiles prefer to be together next to other tiles of the same clump. Moderate values (5-25) create rounder terrain patches, while low values (0-5) create more irregular terrain patches. Negative values create extremely snakey terrains.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'WATER) (land-percent 10) (clumping-factor 2))
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'BAMBOO (base-terrain 'GRASS) (number-of-tiles 500) (clumping-factor 20))
procedure
(land-conformity percentage) → void?
percentage : any/c
Game versions: All
Arguments:
percentage - number (-100 - 100)
0 is the same as not having this attribute
Any negative number behaves the same
100 causes this attribute to override the base-size unless set-circular-base is specified
Useful ranges without set-circular-base: 0~15, 25~35, 45~99, 100
Useful ranges with set-circular-base: 0~10, 20~30, 40~99, 100
Intended as a more potent version of clumping-factor, with higher values conforming more to the shape of the land origin set with base-size, and with negative numbers conforming less to it.
This attribute is currently buggy. We have been advised to avoid using it.
Appears to take the tile count of the land, and apply some math to it and then set a new "radius" for the land. With circles the radius is roughly 1/2 what it should be at any given tile count; it’s much closer to what it should be with squares. Lands tend to not have any tiles, or very few, outside the “radius” above ~35 conformity.
procedure
(base-elevation height) → void?
height : any/c
Sections: <ELEVATION-GENERATION>.
Game versions: UP/HD/DE
height - number (1-16) (default: 0 - not elevated)
In UP/HD elevations higher than 7 should not be used, because objects will fail to render properly.
In DE, elevations higher than 7 can be used, but may cause terrain rendering issues for certain screen resolutions, especially if you go higher than about 16.
Negative values maximally elevate a land (not recommended due to rendering issues).
Elevate the entire land to the specified height.
In HD/DE this will not work for lands with a water terrain-type.
Up to a height of 9 the surrounding terrains will contain the slope, with even higher values, the remaining elevation occurs within the confines of the land.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'PALM_DESERT) (number-of-tiles 128) (base-elevation 2)) <ELEVATION-GENERATION>
procedure
(assign-to-player player-number) → void?
player-number : any/c
Game versions: All
Mutually exclusive with: assign-to
player-number - number 1-8 (default: not assigned to any players)
Assign a land created with create-land to one specific player, allowing you to place starting objects on that land for that player.
Refers to lobby order - the first person in the lobby is player 1, even if they are not blue.
If you want to support 8 players, you must individually assign lands to all 8 players.
Lands assigned to players who are not playing will not be created.
All lands belonging to players will be in a circle and land-position will be ignored, unless direct-placement is specified in <PLAYER-SETUP>.
assign-to-player 0 will make the land Gaia’s player land (not recommended!).
Negative values will create the land without assigning it to anyone.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'DESERT) (land-percent 3) (assign-to-player 1))
Game versions: UP/DE
Mutually exclusive with: assign-to-player
Arguments:
assign-target - AssignTargetConstant (default: not assigned to any players) Options: AT_PLAYER, AT_COLOR, AT_TEAM
- number - varies depending on the assign-target:
AT_PLAYER (1-8): player number (lobby order)
AT_COLOR (1-8): player color
AT_TEAM (-10, -4, -3, -2, -1, 0, 1, 2, 3, 4): team number (lobby order)
0 targets un-teamed players. Negative values target a player NOT on the specified team. -10 gives the land to any player. Teams containing only 1 player do not count as teams. mode - number (-1, 0) 0: random selection (for AT_TEAM only) -1: ordered selection (for AT_TEAM only)
- flags - number (0–3)
0: no flags
1: reset players already assigned before starting
2: do not remember assigning this player
3: both 1 and 2
A more powerful version of assign-to-player. Assign a land created with create-land to a specific player, allowing you to place starting objects for that player.
If you want to support 8 players, you must individually assign lands for all players.
Lands assigned to players who are not playing will not be created.
All lands belonging to players will be in a circle and land-position will be ignored unless direct-placement is specified in <PLAYER-SETUP>.
In DE and WK, the AssignTargetConstants are predefined; in vanilla UP they must be defined manually.
#lang aoe2-rms <PLAYER-SETUP> (direct-placement) <LAND-GENERATION> (create-land (terrain-type 'DIRT) (number-of-tiles 128) (land-position 50 50) (assign-to 'AT_TEAM 1 0 0))
Game versions: All
Mutually exclusive with: set-zone-by-team, set-zone-randomly
Arguments:
zone-number — number
Sets a numeric zone for the land.
Lands sharing the same zone can grow to touch each other. If two lands have different zones and other-zone-avoid?ance-distance is specified, land growth will avoid? touching the other zone.
Do not specify any zone if you want each player to be on their own island.
By default, lands from create-player-lands each get their own unique zone (PlayerNumber - 10). Lands created with create-land all share the same zone (-10).
BUG (AoC/UP/HD): zone 99 will crash the game. This is fixed in DE.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'DIRT) (land-percent 60) (zone 1))
procedure
Game versions: All
Mutually exclusive with: zone, set-zone-randomly
For create-player-lands. Assigns the same zone to all members of the same team.
Lands sharing the same zone can grow to touch each other. If two lands have different zones, and other-zone-avoid?ance-distance is specified, land growth will avoid? touching the other zone.
If used with create-land, it will assign the land to the same zone as the team of player 1, even if the land is a non-player land or is assigned to a member of a different team. (This is not recommended!)
Team zones correspond to (TeamNumber - 9), for example, team 1 is in zone -8.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'DIRT) (land-percent 80) (set-zone-by-team) (other-zone-avoidance-distance 10) (left-border 10) (top-border 10) (right-border 10) (bottom-border 10))
procedure
Game versions: All
Mutually exclusive with: zone, set-zone-by-team
Lands with this attribute will randomly share zones with other lands. Lands sharing the same zone can grow to touch each other. If two lands have different zones, and other-zone-avoid?ance-distance is specified, land growth will avoid? touching the other zone.
Specifically, the land gets a random zone in the range -8 to (PlayerCount - 9). This means:
• The land(s) will never share a zone with a land that is given a positive numeric zone or is a non-player land without a zone assigned. • The land(s) may share a zone with a land that has set-zone-randomly or set-zone-by-team, or that has a manually specified zone in the correct range. • A non-player land with set-zone-randomly will never share a zone with player 1 if player 1 is using their default zone of -9.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'DIRT) (land-percent 80) (set-zone-randomly) (other-zone-avoidance-distance 10) (left-border 10) (top-border 10) (right-border 10) (bottom-border 10))
procedure
(other-zone-avoidance-distance tiles) → void?
tiles : any/c
Game versions: All
tiles - number (default: 0)
Number of tiles away from a land with a different zone to stop land growth. Used to create river maps and island maps.
To keep two lands separated, both lands must have this attribute. When different values are used for two lands, the smaller one applies.
This attribute also keeps randomly positioned land origins/bases the specified distance apart (regardless of zone), but can be overridden by min-placement-distance. Land origins/bases may end up closer together or even touching if land-position is specified, or if used for player lands when there are too many players crammed on too small of a map.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'GRASS) (land-percent 100) (other-zone-avoidance-distance 10)) (create-land (terrain-type 'DIRT) (land-percent 100) (land-position 50 50) (zone 1) (other-zone-avoidance-distance 10))
procedure
(min-placement-distance tiles) → void?
tiles : any/c
Game versions: All
tiles - number (default: value of other-zone-avoid?ance-distance (default: 0))
Number of tiles to stay away from the origins of previously created lands when randomly selecting an origin for this land. Previously undocumented and rarely used.
If min-placement-distance is not specified, land origins will be positioned such that there is at least other-zone-avoid?ance-distance worth of space between the edges of the square origins.
min-placement-distance uses the center of the origins, so for a large base-size, lands may end up closer than an equivalent other-zone-avoid?ance-distance.
If too large of a value is specified and the land cannot find a valid position, it will be placed in the center, regardless of other lands already in or near the center.
No effect when land-position is specified. No effect on player lands, unless direct-placement is active in DE.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'DESERT) (land-percent 1) (min-placement-distance 25)) (create-land (terrain-type 'DESERT) (land-percent 1) (min-placement-distance 25)) (create-land (terrain-type 'DESERT) (land-percent 1) (min-placement-distance 25))
Game versions: All
identifier — number (default: no id)
Assign a numeric label to a land, which can later be used to place objects specifically on that land with "place-on-specific-land-id". This is unrelated to any zone numbers.
Multiple lands can have the same ID. In this case, objects will be placed on all of them.
Must be used after assign-to-player / assign-to since they will reset the ID.
Can theoretically be used for create-player-lands, but will disable the ability to use set-place-for-every-player for object placement. This is sometimes useful for creating "fake" player lands to generate forests or ponds between players.
Note that objects may be placed on surrounding terrain rather than the land itself, if the surrounding terrain supports the object placement.
land-id -9 assigns the land to be the player land of gaia (not recommended!)
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'DIRT) (land-percent 0)) (create-land (terrain-type 'SNOW) (land-percent 0) (land-id 13) (land-position 50 50)) <OBJECTS-GENERATION> (create-object 'GOLD (place-on-specific-land-id 13))
procedure
(color-correction type) → void?
type : any/c
Game versions: DE only
See also: water-definition.
Arguments: type - color correction constant (see: Season Types) (default: no color correction)
Specify a color correction type to apply on your map.
Not visible if the "Map Lighting" setting is disabled.
On UP, use weather-type instead.
#lang aoe2-rms <TERRAIN-GENERATION> (color-correction 'CC_DESERT)
procedure
(set-avoid-player-start-areas distance) → void?
distance : any/c
Game versions: All
Arguments: distance - number (default: 0 - no avoidance)
Defaults to 13, if you specify the argument but omit the distance.
This argument can ONLY be specified in DE.
The terrain will avoid the origins of player lands by the specified number of tiles (with some variance).
Useful to prevent forests or water terrain from being directly under the town center.
In DE the distance can be adjusted.
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'FOREST (base-terrain 'GRASS) (land-percent 100) (number-of-clumps 999) (set-avoid-player-start-areas 2))
procedure
(height-limits min max) → void?
min : any/c max : any/c
Game versions: All
Arguments: min - number (default: none) Max - number (default: none)
The terrain will only be placed on tiles of height between min and max (inclusive).
For most purposes, values between 0–7 are useful. 0 being the standard non-elevated height and 7 being the max height that can be produced by create-elevation.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'GRASS) (number-of-tiles 3000) (number-of-clumps 1)) <TERRAIN-GENERATION> (create-terrain 'DESERT (base-terrain 'GRASS) (land-percent 100) (number-of-clumps 9320) (height-limits 1 6))
procedure
(default-terrain-replacement type) → void?
type : any/c
Game versions: All
Arguments: type - terrain constant (see: Terrains)
Replace ALL terrain in the connection with the specified terrain.
Useful for debugging purposes to quickly visualize all connection paths.
Overrides any previously specified replace-terrain attributes; does not override future attributes.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (land-percent 100) (other-zone-avoidance-distance 10)) <CONNECTION-GENERATION> (create-connect-all-players-land (default-terrain-replacement 'ROAD) (replace-terrain 'WATER 'SHALLOW))
procedure
(replace-terrain old new) → voi?
old : any/c new : any/c
Game versions: All
Arguments: old - terrain constant (see: Terrains) new - terrain constant (see: Terrains)
If the specified terrain is part of the connection, replace it with the new terrain specified.
This attribute can, and should, be used multiple times for different terrains.
A terrain can be replaced with itself.
Connections can pass through terrains even if they are not specified.
DE: The old terrain refers to the terrain present at the beginning of <CONNECTION-GENERATION> — even if that terrain has already been replaced by a previous command or attribute.
This behavior can be disabled by using accumulate-connections.
#lang aoe2-rms <CONNECTION-GENERATION> (create-connect-all-players-land (replace-terrain 'GRASS 'DIRT2) (replace-terrain 'FOREST 'LEAVES) (replace-terrain 'SNOW_FOREST 'GRASS_SNOW) (replace-terrain 'DIRT 'DIRT3) (replace-terrain 'WATER 'SHALLOW))
procedure
(terrain-cost type cost) → void?
type : any/c cost : any/c
Game versions: All
Arguments: type - terrain constant (see: Terrains) cost - number (0-4294967296) (default: 1)
0 (or any negative value) means the connection CANNOT pass through the specified terrain at all; thus, 1 is the "lowest" cost.
For most usual applications, a cost range of 1-15 is sufficient.
DE only: accepts floating-point values.
The cost of having the connection run through the specified terrain.
This attribute can be used multiple times for different terrains.
If all costs are equal, connections will be straight lines.
If some costs are higher, the algorithm prefers routes through lower cost terrains, even if longer.
A cost of 0 prevents connection generation through that terrain; connections requiring crossing such terrain will not generate. Excessive use of this can slow down map generation time.
#lang aoe2-rms <CONNECTION-GENERATION> (create-connect-all-players-land (replace-terrain 'GRASS 'ROAD) (replace-terrain 'FOREST 'LEAVES) (replace-terrain 'WATER 'SHALLOW) (replace-terrain 'MED_WATER 'SHALLOW) (replace-terrain 'DEEP_WATER 'SHALLOW) (terrain-cost 'GRASS 1) (terrain-cost 'FOREST 7) (terrain-cost 'WATER 7) (terrain-cost 'MED_WATER 12) (terrain-cost 'DEEP_WATER 15))
procedure
(terrain-size type radius variance) → void?
type : any/c radius : any/c variance : any/c
Game versions: All
Arguments:
terrain - terrain constant (see: Terrains)
radius - number (default: 1)
variance - number (default: 0)
Given that a Ludicrously-sized map is 480 tiles wide, 961 would be enough to cover the entire map in all situations.
When a connection passes through a tile of the specified terrain, the area within radius +/- variance will be subject to replace-terrain / default-terrain-replacement and terrains will be replaced accordingly.
This attribute can be used multiple times for different terrains.
A radius of 0 will still replace a single-tile width path.
Variance is randomly selected for each tile crossed.
If variance is larger than radius, it can reduce the radius to a negative value, in which case no terrain will be replaced around these specific locations.
#lang aoe2-rms <CONNECTION-GENERATION> (create-connect-all-players-land (replace-terrain 'GRASS 'ROAD) (replace-terrain 'WATER 'SHALLOW) (terrain-size 'GRASS 1 1) (terrain-size 'WATER 3 1))
procedure
Game versions: DE only
Can be used to revert a DE-specific behavior change where all connections are based on the terrain prior to connection generation.Replacing terrain created by earlier connections becomes possible when this is used.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'FOREST) (create-player-lands (terrain-type 'FOREST) (other-zone-avoidance-distance 10)) <CONNECTION-GENERATION> (accumulate-connections) (create-connect-all-lands (replace-terrain 'FOREST 'LEAVES) (terrain-size 'FOREST 10 0)) (create-connect-all-lands (replace-terrain 'LEAVES 'ROAD) (terrain-size 'LEAVES 1 0))
Game versions: DE only
See also: actor-area.
Create an actor area at the given location (rather than being associated with a specific object), with the ID and radius specified.
These actor areas are created before any create-object commands are handled, regardless of their position in the script.
Useful for making certain objects avoid certain positions or areas of the map.
You can also specify coordinates outside of the map, which can be useful with a sufficiently large radius to avoid the map edges.
Note that the X and Y coordinates are in tiles, NOT % of map width. They must be manually scaled to map size. See Map Sizes for the side length on each map size.
Multiple actor areas can share the same identifier.
BUG: create-actor-area will crash the game if no lands are generated on the map. This should not be an issue on completed maps, since you always have lands.
#lang aoe2-rms <OBJECTS-GENERATION> (%cond ['TINY_MAP (create-actor-area 60 60 1234 30)] ['SMALL_MAP (create-actor-area 72 72 1234 36)] ['MEDIUM_MAP (create-actor-area 84 84 1234 42)] ['LARGE_MAP (create-actor-area 100 100 1234 50)] ['HUGE_MAP (create-actor-area 110 110 1234 55)] ['GIGANTIC_MAP (create-actor-area 120 120 1234 60)] ['LUDIKRIS_MAP (create-actor-area 240 240 1234 120)]) (create-object 'RELIC (number-of-objects 500) (set-gaia-object-only) (avoid-actor-area 1234))
procedure
(add-object object-type percentage) → void?
object-type : any/c percentage : any/c
ObjectType - object constant (see: Objects)
% - number (0-99)
Adds an object into group.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object-group 'HERDABLE_A (add-object 'DLC_COW 25) (add-object 'DLC_COW_B 25) (add-object 'DLC_COW_C 25) (add-object 'DLC_COW_D 25)) (create-object 'HERDABLE_A (number-of-objects 6) (number-of-groups 24))
procedure
(number-of-objects amount) → void?
amount : any/c
Game versions: All
Arguments: amount - number (default: 1)
Specifies the number of objects to create.
A maximum of 9320 should be used when also specifying set-scaling-to-map-size.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'GOLD (number-of-objects 10))
procedure
(number-of-groups amount) → void?
amount : any/c
Game versions: All
Arguments: amount - number (default: individual objects — no groups)
Places the specified number of groups, each consisting of the number of individual objects specified in number-of-objects.
Note: Total objects = number-of-objects × number-of-groups A maximum of 9320 should be used when also specifying set-scaling-to-map-size.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'BOAR (number-of-objects 5) (number-of-groups 20))
procedure
(group-variance amount) → void?
amount : any/c
Game versions: All
Arguments: amount - number (default: 0)
Randomly varies the number-of-objects for each group by up to the specified amount.
The maximum positive variance is reduced by 1.
Note: A minimum of 1 object is always created, even if the variance would make the count 0 or negative. Each group varies independently — so this is not suitable for ensuring balanced player resources. Use Random Code for fairness instead.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'FORAGE (number-of-objects 5) (number-of-groups 10) (group-variance 3) (set-tight-grouping))
procedure
(group-placement-radius radius) → void?
radius : any/c
Game versions: All
Arguments: radius - number (default: 3 = a 7x7 area)
Specifies how far (in tiles) objects in the same group may spawn from the central tile. This activates grouping behavior.
Prevents grouped resources like gold, stone, or berries from forming long lines.
If number-of-objects exceeds available tiles, a perfect square will be filled.
If combined with set-loose-grouping and set-circular-placement, the group area will be circular instead of square.
procedure
Game versions: All
Mutually exclusive with: set-loose-grouping
Forces objects in the same group to be placed on adjacent tiles. Commonly used for tightly grouped resources like berries, gold, or stone.
Activates grouping behavior.
Objects larger than one tile and that cannot overlap (e.g., buildings) will not be placed with tight grouping.
Most placement constraints (avoid-forest-zone, min-distance-to-map-edge, min-distance-group-placement, avoid-actor-area) apply only to the group’s center, not to individual objects.
Use set-loose-grouping instead if you want constraints to apply to each group member.
procedure
Game versions: All
Mutually exclusive with: set-tight-grouping
Allows objects in the same group to be placed freely within the area defined by group-placement-radius. Activates grouping behavior.
Loose grouping is the default, so you can omit this attribute if you specify group-placement-radius. Commonly used for scattered objects like sheep or deer.
When combined with set-circular-placement, the placement area becomes circular instead of square.
Most placement constraints (avoid-forest-zone, min-distance-to-map-edge, min-distance-group-placement, avoid-actor-area) apply to each group member individually.
The game does not check if there is enough room for the whole group when picking a location, so some objects may fail to spawn.
For important resources or objects with many placement constraints, use set-tight-grouping instead.
procedure
(min-connected-tiles amount) → void?
amount : any/c
Game versions: DE only
Arguments: amount - number (default: 0)
Requires: objects must be placed in groups
Prevents grouped objects from being placed in an area with fewer tiles than the specified amount. Intended to keep objects off tiny islands or out of small forest clearings.
BUG: Objects become heavily biased towards spawning in the top-left corner of the map, making this attribute unreliable for its intended purpose. Use max-distance-to-other-zones or avoid-forest-zone instead.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'BAMBOO) (create-player-lands (land-percent 50) (border-fuzziness 1) (left-border 25) (right-border 25) (top-border 25) (bottom-border 25) (zone 1)) <OBJECTS-GENERATION> (create-object 'SHEEP (number-of-objects 4) (number-of-groups 150) (set-tight-grouping) (min-connected-tiles 80))
procedure
(resource-delta amount) → void?
amount : any/c
Game versions: UP/DE
Arguments: amount - number (default: 0)
Modify the amount of food, wood, gold, or stone in an object. Negative values can be used to reduce the resources.
Does not work for farms.
Does not appear when testing a map from the scenario editor.
You can give food to wolves. However, if a villager kills a wolf, they will automatically gather the food instead of performing the assigned task, which can affect gameplay.
In UP, resource amount will overflow past 32767.
In DE, resource amount will overflow past 2147483647 (but will become inaccurate before then).
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'GOLD (number-of-objects 7) (resource-delta -100)) (create-object 'STONE (number-of-objects 7) (resource-delta 100))
procedure
(second-object object-type) → void?
object-type : any/c
Game versions: DE only
Arguments: object-type - object constant (see: objects)
Specify ANY object to be placed on top of the main object. If you place multiple objects, each will get the specified second object.
In official maps, villagers were placed on top of farms for empire wars using this.
Can bypass terrain restrictions by using an invisible placeholder object as the main object.
For off-grid placeholders, any dead unit can be used, especially dead heroes without graphics in DE (e.g., ID 647).
For on-grid placeholders, try terrain blocker (ID 1613), dead fish trap (ID 278), or a berry bush with zero food (using resource-delta).
Avoid using object 1291, as it now permanently converts player sheep to gaia in recent updates.
Alternatively, terrain restrictions can be changed with effect-amount or removed entirely with ignore-terrain-restrictions.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'TOWN_CENTER (set-place-for-every-player) (max-distance-to-players 0) (second-object 'DLC_COW))
procedure
Game versions: All
Mutually exclusive with: set-scaling-to-player-number
Scales number-of-groups to the map size. The unscaled value refers to a 100x100 map (see: Map Sizes for the scaling table).
If no grouping is present, scaling applies to number-of-objects instead.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'GOLD (number-of-objects 10) (number-of-groups 3) (set-scaling-to-map-size) (set-tight-grouping))
procedure
Game versions: All
Mutually exclusive with: set-scaling-to-map-size
Scales number-of-groups based on the player count. For example, scales by 2x for a 2-player game, and 8x for an 8-player game.
If no grouping is present, scaling applies to number-of-objects instead.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'RELIC (number-of-objects 2) (set-scaling-to-player-number))
procedure
Game versions: All
Mutually exclusive with: place-on-specific-land-id
Places the object(s) as a personal object for each player land. Objects that cannot be owned by players (e.g., boar, gold, trees) also require set-gaia-object-only to be placed for every player.
Only works for player lands or lands assigned to players; disabled if land-id is specified.
- Objects will only be placed where they are not separated from their land origin by a terrain they are restricted on, unless ignore-terrain-restrictions is used.
This means resources on islands will only appear on the player’s own island.
Player gold mines on acropolis can only be placed on hilltops due to gold’s terrain restrictions.
Water objects (docks/boats) can be placed if the player land is made of a dirt terrain type.
Terrain restrictions can be bypassed by using placeholders with second-object, modified with effect-amount, or removed with ignore-terrain-restrictions.
Road terrains, although restricted for resources, do not create separation like other terrains do.
If avoid-other-land-zones is specified, the object will only be placed on tiles belonging to that land.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'VILLAGER (set-place-for-every-player) (min-distance-to-players 6) (max-distance-to-players 7))
procedure
(place-on-specific-land-id id) → void?
id : any/c
Game versions: All
Mutually exclusive with: set-place-for-every-player
Arguments: id - number
Places the object(s) on each land with the specified identifier. Land IDs are assigned in <LAND-GENERATION> using the land-id attribute.
Objects will only be placed where they are not separated from the origin of their land by a terrain they are restricted on, unless ignore-terrain-restrictions is used.
Road terrains, although restricted for resources, do not create separation like other terrains do.
If avoid-other-land-zones is specified, the object will only be placed on tiles belonging to that land.
If multiple lands share the same ID, the object(s) will be placed on all of those lands.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'DIRT) (land-percent 0)) (create-land (terrain-type 'SNOW) (land-percent 0) (land-id 13) (land-position 50 50)) <OBJECTS-GENERATION> (create-object 'GOLD (place-on-specific-land-id 13) (find-closest))
procedure
(avoid-other-land-zones distance) → void?
distance : any/c
Game versions: DE only
Requires: set-place-for-every-player or place-on-specific-land-id
Arguments: distance - number (default: no avoidance)
Ensures that an object is placed only on tiles belonging to the land it is associated with, avoiding the edges of that land by the specified distance.
If this attribute is NOT specified, objects may be placed outside their referenced land.
Even if 0 or a negative value is specified, objects will still be confined to the land.
Do not use this attribute if you want objects to be placed beyond the land borders.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'DESERT) (land-percent 10) (land-id 1)) <OBJECTS-GENERATION> (create-object 'GOLD (place-on-specific-land-id 1) (set-gaia-object-only) (number-of-objects 999) (avoid-other-land-zones 4))
procedure
Game versions: DE only
Requires: set-place-for-every-player or place-on-specific-land-id
When multiple create-player-lands commands exist or multiple lands share the same land-id, this attribute restricts the object placement to only the first applicable land instead of all relevant lands.
procedure
Game versions: All
Use together with set-place-for-every-player to place gaia (neutral) objects individually for each player. Required when placing player resources like gold, stone, berries, deer, or boar.
Can also be used for controllable objects (e.g., sheep).
Units and buildings will permanently join the player who first discovers them, unless set-gaia-unconvertible is also specified.
Gaia building architectural style can be changed with set-gaia-civilization.
procedure
Game versions: DE only
Requires: set-gaia-object-only
Mutually exclusive with: set-building-captureable
Use with any gaia object to make it unrescuable by players and hostile towards them. Must be specified after set-gaia-object-only.
Gaia military units behave as if on defensive stance—attacking anything entering their search radius and retreating if you run away.
Does not work when testing from the scenario editor.
Unrescuable status does not apply to second-object.
Certain objects are always convertible (e.g., monuments) or buggy (e.g., town centers, gates).
Gaia markets lose functionality and cannot be traded with. Use object 1646 for an indestructible market to trade with players.
Villagers will repair gaia buildings instead of attacking them.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'PYRAMID (number-of-objects 3) (set-gaia-object-only) (set-gaia-unconvertible) (make-indestructible))
procedure
Game versions: DE only
Mutually exclusive with: set-gaia-unconvertible
Used to make a building switch control to the player who most recently has units nearby. Has no effect on units or other non-building objects.
Can be applied to buildings starting under gaia or player control.
Capturable buildings cannot be deleted.
Capturable buildings can be destroyed unless make-indestructible is used.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'OUTPOST (set-gaia-object-only) (make-indestructible) (set-building-capturable))
procedure
Game versions: DE only
Makes a building indestructible by granting it 9999 HP and 1000/1000 armor. The building cannot be attacked, damaged, or deleted.
Has no effect on units or other non-building objects.
Can be used to create neutral gaia markets, docks, or entire cities that are invulnerable.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'TOWN_CENTER (set-place-for-every-player) (max-distance-to-players 0) (make-indestructible))
procedure
(min-distance-to-players distance) → void?
distance : any/c (max-distance-to-players distance) → void? distance : any/c
Game versions: All
Arguments:
distance - number (default: no limits)
Specifies the minimum distance (in tiles) from the origin of player lands at which the object or group center can be placed.
Distances define a square area, not a circle, unless set-circular-placement is used.
For grouped objects, distance applies to the group’s center, not individual members.
When used with place-on-specific-land-id, distances refer to that land specifically.
When used without set-place-for-every-player or place-on-specific-land-id, maximum distance has no effect.
BUG (DE): Minimum distance applies to all lands, not just player lands or specified land IDs. To work around this, use an actor-area to control placement.
BUG: When minimum equals maximum distance, objects tend to be biased toward western placement.
BUG (pre-DE): Minimum distance always applies to all lands.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'SCOUT (set-place-for-every-player) (min-distance-to-players 7) (max-distance-to-players 9))
procedure
Game versions: DE only
Changes the behavior of min-distance-to-players and max-distance-to-players to use circular (Euclidean) distance instead of a square radius.
This prevents resources placed diagonally from being disproportionately far away compared to orthogonal placements.
Recommended for most player object placements to improve resource distribution, unless map features like walls (which use square logic) are involved.
Additionally, when used with groups that have set-loose-grouping, the group placement radius defined by group-placement-radius will become circular instead of square.
procedure
(terrain-to-place-on type) → void?
type : any/c
Game versions: All
Arguments: type - terrain constant (see: Terrains) (default: any valid terrain)
Restricts the placement of the object(s) to only the specified terrain type.
procedure
(layer-to-place-on type) → void?
type : any/c
Game versions: DE only
Arguments: type - terrain constant (see: Terrains) (default: any layer)
Restricts the placement of the object(s) to only the specified layering terrain.
Works with terrain-mask 1, but not with terrain-mask 2. For terrain-mask 2, use terrain-to-place-on instead, since the layer becomes the main terrain.
When used together with terrain-to-place-on, objects will be placed only where both the base terrain and the layer apply.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'DESERT) (number-of-tiles 500) (land-position 50 50)) <TERRAIN-GENERATION> (create-terrain 'SNOW (base-terrain 'DESERT) (number-of-tiles 20) (terrain-mask 1)) <OBJECTS-GENERATION> (create-object 'ROCK (number-of-objects 300) (layer-to-place-on 'DESERT))
procedure
Game versions: DE only
Requires: set-place-for-every-player or place-on-specific-land-id
Allows objects to be placed on terrains they are normally restricted from. These terrains will no longer act as borders preventing placement. Must be used in conjunction with set-place-for-every-player or place-on-specific-land-id.
Can be combined with terrain-to-place-on
Alternatively, terrain restrictions can be modified using effect-amount on ATTR_TERRAIN_ID, or by using second-object with a placeholder.
procedure
(max-distance-to-other-zones distance) → void?
distance : any/c
Game versions: All
Arguments: distance - number (default: 0)
Specifies the minimum distance, in tiles, that objects will maintain from terrains they are restricted from being placed on. Useful for keeping resources away from coastlines or preventing deep fish from spawning near beaches.
For grouped objects, distance is measured from the center of the group, not individual members.
Does not apply to road terrains, even though resources cannot be placed on them.
Has no effect on objects without terrain restrictions.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'WATER) (number-of-tiles 500) (land-position 50 50)) <OBJECTS-GENERATION> (create-object 'GOLD (number-of-groups 9000) (set-gaia-object-only) (max-distance-to-other-zones 5))
procedure
Game versions: DE only
Mutually exclusive with: avoid-forest-zone
Place objects only on tiles with trees or directly adjacent to such tiles. This includes straggler trees and trees placed via the scenario editor.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'SHEEP (number-of-objects 99999) (place-on-forest-zone))
procedure
(avoid-forest-zone distance) → void?
distance : any/c
Game versions: DE only
Mutually exclusive with: place-on-forest-zone
Arguments: distance - number (default: no avoidance; defaults to 1 if specified without a value)
Objects will stay the specified number of tiles away from any trees, including straggler trees and scenario editor trees. Commonly used to keep resources away from forests.
The forest trees themselves are avoided, so for sparse forests (e.g., baobab), larger distances may be necessary.
If the objects are grouped, the distance applies to each individual group member.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'GOLD (number-of-objects 9999) (avoid-forest-zone 3))
procedure
(avoid-cliff-zone distance) → void?
distance : any/c
Game versions: DE only
Arguments: distance - number (default: no avoidance; defaults to 1 if specified without a value)
Objects will stay the specified number of tiles away from cliffs. Due to the size of cliff objects, a distance of at least 2 is recommended to ensure a gap between cliffs and the objects.
Useful for preventing inaccessible resources.
If the objects are grouped, the distance applies to each individual group member.
#lang aoe2-rms <CLIFF-GENERATION> <OBJECTS-GENERATION> (create-object 'STONE (number-of-objects 9999) (avoid-cliff-zone 4))
procedure
(min-distance-to-map-edge distance) → void?
distance : any/c
Game versions: DE only
Arguments: distance - number (default: 0)
Minimum distance, in tiles, that objects will stay away from the edge of the map.
If the objects are grouped, the distance refers to the center of the group, not the individual group members.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'RELIC (set-gaia-object-only) (number-of-objects 500) (min-distance-to-map-edge 10))
procedure
(min-distance-group-placement distance) → void?
distance : any/c
Game versions: All
Arguments: distance - number (default: 0)
Minimum distance, in tiles, that individual objects of the same create-object command, and all future objects, must stay away from each object.
Best used with small values to keep different resources from being directly next to each other.
To scatter objects from the same command far away from each other, use temp-min-distance-group-placement.
If the objects are grouped, the distance refers to the center of the group, not the individual members.
procedure
(temp-min-distance-group-placement distance) → void?
distance : any/c
Game versions: All
Arguments: distance - number (default: 0)
Similar to min-distance-group-placement, but only applies to the current create-object command — future objects are unaffected.
Useful for scattering objects, such as neutral resources and relics.
Can be used together with min-distance-group-placement.
If the objects are grouped, the distance refers to the center of the group, not the individual members.
procedure
(find-closest) → void?
Game versions: DE only
Requires: set-place-for-every-player or place-on-specific-land-id
Place the object on the closest free tile to the center of the land, considering all other constraints.
Important:
find-closest uses circular (Euclidean) distance, whereas other distance constraints (e.g., min-distance-to-players) use square distance by default.
Because of this, using both find-closest and min-distance-to-players (without additional constraints) may cause objects to be placed at right angles to each other, as the square’s corners are farther from the center than its edges. Use set-circular-placement combined with enable-tile-shuffling to resolve this issue.
Previously, using find-closest with reference to a land origin would place the object directly on the origin (if no other restrictions applied). But now, it places the object one tile away.
Use max-distance-to-players 0 if you need the object placed exactly on the origin.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'FISHING_SHIP (set-place-for-every-player) (ignore-terrain-restrictions) (terrain-to-place-on 'WATER) (find-closest))
procedure
Game versions: DE only
Requires: set-place-for-every-player or place-on-specific-land-id
Place the object on the closest free tile to the center of the map, considering all other constraints.
This attribute is overridden by find-closest.
Bug: When used with loosely grouped objects, some group members may fail to spawn if the closest free area is too small. Detailed bug description.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'BOAR (set-place-for-every-player) (set-gaia-object-only) (find-closest-to-map-center))
procedure
Game versions: DE only
Requires: set-place-for-every-player or place-on-specific-land-id
Place the object on the closest free tile to the edge of the map, considering all other constraints.
This attribute is overridden by find-closest and find-closest-to-map-center.
Bug: When used with loosely grouped objects, some group members may fail to spawn if the closest free area is too small. Detailed bug description.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'RELIC (set-place-for-every-player) (set-gaia-object-only) (find-closest-to-map-edge))
procedure
(require-path deviation) → void?
deviation : any/c
Game versions: DE only
Requires: set-place-for-every-player or place-on-specific-land-id
0 - indirect paths allowed; no additional restrictions beyond preventing completely inaccessible locations.
1 - only mostly direct paths allowed to the origin.
>1 - allows more deviation from the direct path; maximum effective value depends on path constriction.
No argument, or a value of 0 imposes no further restrictions beyond preventing a completely inaccessible location.
An argument of 1 means that the object must additionally have a mostly direct path to the origin.
Larger values allow paths that are less direct. Maximum effective value depends on how constricted the path is.
Walls (and gates) count as obstructing a path, so this attribute should not be used for objects outside of a player’s walls on walled maps.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'BOAR (set-place-for-every-player) (set-gaia-object-only) (require-path 1) (min-distance-to-players 16) (max-distance-to-players 22))
procedure
(force-placement) → void?
Game versions: DE only
Allows multiple objects to be placed on the same tile if necessary. Normally, only one object per tile is placed; when tiles run out, no more objects are placed. With force-placement, remaining objects are placed on tile corners, then on top of each other.
Only works for objects that can overlap on the same tile (e.g., units, but not buildings).
Disabled when using set-loose-grouping.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'OUTPOST (set-place-for-every-player) (max-distance-to-players 0)) (create-object 'SHEEP (number-of-objects 50) (set-place-for-every-player) (max-distance-to-players 1) (force-placement))
procedure
(actor-area id) → void?
id : any/c
Game versions: DE only
See also: create-actor-area.
Arguments:
id - number (default: 0 - no actor area)
Specifies a numerical identifier for an actor area. This identifier can be referenced in future objects with avoid-actor-area or actor-area-to-place-in.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'RELIC (number-of-objects 5) (set-gaia-object-only) (temp-min-distance-group-placement 35) (actor-area 1234)) (create-object 'WOLF (number-of-objects 9320) (set-gaia-object-only) (actor-area-to-place-in 1234) (temp-min-distance-group-placement 25))
procedure
(actor-area-radius radius) → void?
radius : any/c
Game versions: DE only
Requires: actor-area
Arguments:
radius - number (default: 1 = 3x3 area)
Specifies the size of the actor area when used with actor-area. If multiple objects share the same actor-area value, they will all share the radius of the first object successfully created.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'MILL (set-place-for-every-player) (min-distance-to-players 16) (max-distance-to-players 20) (actor-area 61) (actor-area-radius 7)) (create-object 'DEER (number-of-objects 7) (set-place-for-every-player) (set-gaia-object-only) (actor-area-to-place-in 61))
procedure
Game versions: DE only
Requires: actor-area-to-place-in
Prevents buildings from overlapping when placed inside an actor-area with a radius too small to contain them, by expanding the valid placement area outward.
Commonly used to ensure proper building placement (e.g., Empire Wars mills that become folwarks for Poles). Does not apply to units.
procedure
(actor-area-to-place-in id) → void?
id : any/c
Game versions: DE only
Arguments: id - number
Place the object only within the radius of the specified actor-area or create-actor-area.
The same object can only have one actor-area-to-place-in.
Actor areas have some intricacies that can affect placement. If you are having issues, follow these guidelines:
Different objects can be assigned to the same actor area.
Do not place origin-referenced (either player or land id) objects in generic actor areas.
Placing generic objects into land id-referenced actor areas always works.
Placing generic objects into land id-referenced actor areas always works.
Placing player objects into land id-referenced actor areas always works.
Only player objects should be placed into player-referenced actor areas.
When placing generic objects in generic actor areas, try to have the fewest create-object commands possible between the actor area creation and the object to be placed in it.
When none of the rules can be satisfied, inverse actor areas can be used as a failsafe.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'LUMBER_CAMP (set-place-for-every-player) (max-distance-to-players 67) (place-on-forest-zone) (find-closest) (actor-area 8) (actor-area-radius 4)) (create-object 'VILLAGER (set-place-for-every-player) (number-of-objects 4) (actor-area-to-place-in 8) (place-on-forest-zone) (find-closest))
procedure
(avoid-actor-area id) → void?
id : any/c
Game versions: DE only
Arguments: id - number
The object will avoid the specified actor-area or create-actor-area. The same object can avoid multiple actor areas. You can specify an actor-area and then avoid that same actor area within the same create-object. However, this only works with ungrouped objects, or those with set-loose-grouping.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'BARRACKS (set-place-for-every-player) (min-distance-to-players 7) (max-distance-to-players 9) (avoid-actor-area 94) (avoid-actor-area 40) (avoid-actor-area 8) (avoid-actor-area 9) (avoid-actor-area 99) (avoid-actor-area 171) (actor-area 51) (actor-area-radius 5))
procedure
Game versions: DE only
The object will avoid being placed within ANY existing actor-area or create-actor-area
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'TOWN_CENTER (set-place-for-every-player) (max-distance-to-players 0) (actor-area 100) (actor-area-radius 60)) (create-object 'WOLF (number-of-objects 9320) (temp-min-distance-group-placement 52) (avoid-all-actor-areas))
procedure
Game versions: DE only
Increases randomness of object positions by shuffling the list of candidate tiles rather than just using the first entry.
When using both find-closest and set-circular-placement, add this attribute to prevent objects from being in predictable positions.
Does not prevent the bias towards the west when min-distance-to-players and max-distance-to-players are close or equal.
Should NOT be used when attempting to place objects in a specific precise location (ie. placing herdables or villagers under the town center.)
Game versions: DE only
Arguments:
facet-number - number (default: 0 - random facet) FacetNumber corresponds to the index - 1 of the desired frame in the sprite. To get the first frame, pick a facet number below 0, or above the maximum for that object.
For units, this corresponds to the angle they are facing.
For other objects, this may correspond to alternative appearances. Facets can be cycled by using the rotate feature in the scenario editor.
Frames can be viewed using external tools such as SLX Studio.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'JUNGLETREE (number-of-objects 10) (set-facet 30))