3.3 Blocks
For any block form, attributes created within the body forms will become attributes of given block. Execution of the bodies is deferred to after the expansion of the block forms, if you want to create custom block constructors via functions, wrap the bodies in callbacks.
syntax
(create-player-lands body ...)
body : any/c
Attributes: terrain-type, land-percent, number-of-tiles, base-size, set-circular-base, generate-mode, circle-radius, left-border, right-border, top-border, bottom-border, border-fuzziness, clumping-factor, land-conformity, base-elevation, zone, set-zone-by-team, set-zone-randomly, other-zone-avoidance-distance and land-id.
Game versions: All
Creates a land for every player.
Usually this command is used only once, but it can be repeated to, for example, give every player two starting towns.
Not required — you can use create-land with the assign-to-player or assign-to attributes to give lands directly to individual players instead (or in addition to creating player lands).
If you do not give players any lands at all, you cannot give them any starting units or resources. They will start at an entirely random location with only a town center, villagers, and scout. This is NOT recommended.
DE: Using direct-placement with create-player-lands disables the circular land positioning, so this is usually not desirable.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DIRT) (land-percent 20))
syntax
(create-land body ...)
body : any/c
Attributes: terrain-type, land-percent, number-of-tiles, base-size, set-circular-base, land-position, left-border, right-border, top-border, bottom-border, border-fuzziness, clumping-factor, land-conformity, base-elevation, assign-to-player, assign-to, zone, set-zone-randomly, other-zone-avoidance-distance, min-placement-distance and land-id.
Game versions: All
Create a single non-player (neutral) land.
Can be assigned to a player with assign-to-player or assign-to.
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'WATER) (land-percent 10) (land-position 50 50))
syntax
(create-elevation max-height body ...)
max-height : any/c
body : any/c
Attributes: base-terrain, base-layer, number-of-tiles, number-of-clumps, set-scale-by-size, set-scale-by-groups, spacing and enable-balanced-elevation.
Game versions: All
max-height — number (1-16) (default: 0 — not elevated)
Create one or more hills of random height, up to the given height.
When creating a single hill, this hill will always attempt to reach the height specified.
Hills with a small number of base tiles are not able to reach as high.
HD/DE: If terrain has already been elevated with a land’s base-elevation, new hills will be relative to that height.
UP: Hills always use an absolute height, even if a terrain has already been elevated with a land’s base-elevation.
Pre-DE: maximum is 7.
Higher elevations towards 16 may cause unwanted behavior, such as TC projectiles firing in a different way.
#lang aoe2-rms <ELEVATION-GENERATION> (create-elevation 7 (base-terrain 'GRASS) (number-of-tiles 600))
syntax
(create-terrain type body ...)
type : any/c
body : any/c
Attributes: base-terrain, base-layer, beach-terrain, terrain-mask, spacing-to-other-terrain-types, spacing-to-specific-terrain, set-flat-terrain-only, land-percent, number-of-tiles, number-of-clumps, clumping-factor, set-scale-by-size, set-scale-by-groups, set-avoid-player-start-areas and height-limits.
Game versions: All
type - terrain constant (see: Terrains) (default: GRASS)
Create a clump of terrain. The exact behavior is dependent on the attributes specified.
#lang aoe2-rms <TERRAIN-GENERATION> (create-terrain 'FOREST (base-terrain 'GRASS) (land-percent 10))
syntax
(create-connect-all-players-land body ...)
body : any/c
Attributes: default-terrain-replacement, replace-terrain, terrain-cost and terrain-size.
Game versions: All
Connections will be generated between the origins of all player lands, and all lands assigned to players.
Connections may pass through neutral lands if the cost is favorable.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DESERT) (number-of-tiles 100)) <CONNECTION-GENERATION> (create-connect-all-players-land (default-terrain-replacement 'DIRT))
syntax
(create-connect-teams-lands body ...)
body : any/c
Attributes: default-terrain-replacement, replace-terrain, terrain-cost and terrain-size.
Game versions: All
Connections will be generated between the origins of player lands belonging to members of the same team.
Connections may pass through neutral or enemy lands if the cost is favorable. By default, players are on their own team in the scenario editor, so keep this in mind when testing in the scenario editor.
You can use the diplomacy tab to simulate team setups.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DESERT) (number-of-tiles 100)) <CONNECTION-GENERATION> (create-connect-teams-lands (replace-terrain 'DESERT 'ROAD) (replace-terrain 'GRASS 'ROAD))
syntax
(create-connect-all-lands body ...)
body : any/c
Attributes: default-terrain-replacement, replace-terrain, terrain-cost and terrain-size.
Game versions: All
Connections will be generated between the origins of all lands.
#lang aoe2-rms <LAND-GENERATION> (base-terrain 'WATER) (create-player-lands (terrain-type 'DESERT) (number-of-tiles 100)) (create-land (terrain-type 'FOREST) (number-of-tiles 100) (land-position 99 1)) (create-land (terrain-type 'PINE_FOREST) (number-of-tiles 100) (land-position 50 50)) <CONNECTION-GENERATION> (create-connect-all-lands (replace-terrain 'WATER 'SHALLOW))
syntax
(create-connect-same-land-zones body ...)
body : any/c
Attributes: default-terrain-replacement, replace-terrain, terrain-cost and terrain-size.
Game versions: DE only
Connect all player lands to all neutral lands, but do not directly generate connections between individual players.
BUG: create-connect-to-nonplayer-land blocks all future connection generation. BUG: It also blocks all team connection generation (except those involving player 1), when used after create-connect-teams-lands.
syntax
(create-connect-land-zones zone1 zone2 body ...)
body : any/c
Attributes: default-terrain-replacement, replace-terrain, terrain-cost and terrain-size.
Game versions: DE only
Arguments:
zone1 - numeric zone ID zone2 - numeric zone ID
Generate connections between all lands belonging to the zones listed.
By default lands from create-player-lands are each in their own unique zone (PlayerNumber - 10), while lands created with create-land all share the same zone (-10).
#lang aoe2-rms <LAND-GENERATION> (create-land (terrain-type 'FOREST) (land-percent 5) (zone 1)) (create-land (terrain-type 'DESERT) (land-percent 5) (zone 1)) (create-land (terrain-type 'WATER) (land-percent 5) (zone 50)) <CONNECTION-GENERATION> (create-connect-land-zones 1 50 (default-terrain-replacement 'ICE))
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DESERT) (land-percent 5)) <CONNECTION-GENERATION> (create-connect-land-zones -6 -8 (default-terrain-replacement 'ROAD))
syntax
(create-connect-to-nonplayer-land body ...)
body : any/c
Attributes: default-terrain-replacement, replace-terrain, terrain-cost and terrain-size.
Game versions: DE only
Connect all player lands to all neutral lands, but do not directly generate connections between individual players.
BUG: create-connect-to-nonplayer-land blocks all future connection generation. BUG: It also blocks all team connection generation (except those involving player 1), when used after create-connect-teams-lands.
#lang aoe2-rms <LAND-GENERATION> (create-player-lands (terrain-type 'DIRT2) (number-of-tiles 100)) (create-land (terrain-type 'DESERT) (number-of-tiles 500) (land-position 50 50)) <CONNECTION-GENERATION> (create-connect-to-nonplayer-land (replace-terrain 'GRASS 'ROAD2))
syntax
(create-object type body ...)
type : any/c
body : any/c
Attributes: number-of-objects, number-of-groups, group-variance, group-placement-radius, set-tight-grouping, set-loose-grouping, min-connected-tiles, resource-delta, second-object, set-scaling-to-map-size, set-scaling-to-player-number, set-place-for-every-player, place-on-specific-land-id, avoid-other-land-zones, generate-for-first-land-only, set-gaia-object-only, set-gaia-unconvertible, set-building-capturable, make-indestructible, min-distance-to-players, max-distance-to-players, set-circular-placement, terrain-to-place-on, layer-to-place-on, ignore-terrain-restrictions, max-distance-to-other-zones, place-on-forest-zone, avoid-forest-zone, avoid-cliff-zone, min-distance-to-map-edge, min-distance-group-placement, temp-min-distance-group-placement, find-closest, find-closest-to-map-center, find-closest-to-map-edge, require-path, force-placement, actor-area, actor-area-radius, override-actor-radius-if-required, actor-area-to-place-in, avoid-actor-area, avoid-all-actor-areas, enable-tile-shuffling and set-facet.
Game versions: All
Arguments:
type - object constant (see: Objects)
Place the specified object, according to the chosen attributes.
#lang aoe2-rms <OBJECTS-GENERATION> (create-object 'GOLD (number-of-objects 10))
syntax
(create-object-group name body ...)
type : any/c
body : any/c
Attributes: add-object.
Game versions: DE only Arguments:
ANY characters are valid; convention is to use uppercase letters and underscores
List a selection of objects with probabilities. When the chosen constant name is used in your script, an object will be chosen from the group at random, using the specified probabilities.
If a group of objects is placed, each one will be individually randomized.
If used with set-place-for-every-player, the group will be randomized each time, so a group generally should not contain objects with different resource amounts or different gameplay effects.
BUG: The % currently doesn’t work; all objects in the group are equally likely regardless of what number you specify.
#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))