Hi Everyone!
1/ I've been working on another coding project for the OXCE+ version of the engine, and just got a new feature working: using map scripts to add map blocks from other terrains. This allows you to do things like adding some forest to a simple farmland ufo mission, like in the screenshot I've attached. The original intent was to start adding support for having an above-ground portion to base defense maps, but it turned into making more general tools for this purpose. Map scripts can be given an optional command terrain:, which allows you to pull in a map block from any defined terrain. This works for addBlock, addLine, addCraft, addUFO, and fillArea.
For the example of the farm/forest hybrid map, the script looks like this:
mapScripts:
- type: FARM
commands:
- type: addUFO
- type: addCraft
- type: addBlock
terrain: FOREST
size: 2
executions: 2
- type: fillArea
blocks: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
maxUses: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
2/ The second part of the new code is adding special 'filler' terrains for base defense missions. In globe.rul, where terrain: is defined by geoscape texture, I've added the possibility to define baseTerrain: in the exact same way - these are to replace the nondescript dirt fill-in with whatever you want. Maybe you want your base to be placed right next to a charming little farm? Or have snow cover in the arctic? The commands I described above will do this with the base squares not filled with facilities by setting the terrain: in the command to "baseTerrain" as in the script example below. I also added an option baseDefenseMapFromLocation to seed the RNG for generating the base defense maps from the latitude and longitude of the base, so your bases won't have an overactive ground crew completely redoing the landscaping in-between every time your base is attacked.
Edit by Meridian: baseDefenseMapFromLocation seems to be mandatory, not optional, for "baseTerrain" to work
terrains:
- name: XBASE_FILL
mapDataSets:
- FOREST
mapBlocks:
- name: XBASE_FOREST00
width: 10
length: 10
- name: XBASE_FOREST01
width: 10
length: 10
- name: XBASE_FOREST02
width: 10
length: 10
- name: XBASE_FOREST03
width: 10
length: 10
- name: XBASE_FOREST04
width: 10
length: 10
- type: XBASE
commands:
- type: digTunnel
direction: both
tunnelData:
level: 0
MCDReplacements:
- type: westWall
set: 1
entry: 13
- type: northWall
set: 1
entry: 14
- type: fillArea
terrain: baseTerrain
globe:
textures:
- id: 0
terrain:
- name: FOREST
area: [0, 360, -90, 0]
- name: JUNGLE
area: [0, 360, 0, 90]
baseTerrain:
- name: XBASE_FILL
- id: 1
terrain:
- name: CULTA
baseTerrain:
- name: XBASE_FILL
#... etc, adding baseTerrain for each texture id: ...
The second attached image shows an example of this at work, though it's not as nice since I messed up making/editing the maps.
Note: This code has been included in Yankes' OXCE and Meridian's OXCE+ executables, see their threads for source code and .exe's!