It's a bit disappointing that this thread has not attracted any dev comments of any kind.
Anyway, a side note that this does not change the map format. It only affects the game engine. The maps folder will be structured like how scenarios are, with each map in a folder. The
mgm/
gbm file must have the same name as this folder, as should the XML file that defines the "extension" of the map (the "scenario" portion, if you will). Thus, the map editor requires zero changes.
As an example of what the XML file might look like:
<map>
<players>
<!-- One neutral faction of animals inhabits the map -->
<player faction="glestimals" aggressiveness="3" team="9"/>
</players>
<particle-files>
<!-- Load a particle system file -->
<particle-file name="towerParticles" file="tower_particles.xml" />
</particle-files>
<models>
<!-- A tower model is placed in the center of the 128 x 128 map (at coordinates {64, 64}) -->
<model name="darkTower" file="dark_tower.g3d" x="64" y="64" size="10" active="true">
<!-- The model uses the previously loaded particle system -->
<particle value="towerParticles" />
</model>
</models>
<regions>
<region name="nearTower">
<!-- The center of the tower is located at {64, 64}, so this region is a 20 x 20
rectangle that surrounds this tower -->
<rectangle-selection x1="54" y1="54" x2="74" y2="74" />
</region>
</regions>
<!-- Lua code starts here -->
<startup>
insideTowerRegionTimer = startTimerEvent() -- Start a timer to check if units are inside the tower region
createUnit('bear', 9, {50, 70}) -- Places a bear from the glestimals faction near the tower (coordinates {50, 70})
</startup>
<timerTriggerEvent>
-- Check if the event that triggered the timer is the same as the timer we created
if triggeredTimerEventId() == insideTowerRegionTimer then
-- Check if at least 2 seconds have elapsed
if timerEventSecondsElapsed(triggeredTimerEventId()) >= 2 then
unitsNearTower = getUnitsInRegion('nearTower') -- Get units in region
-- Use a for loop to iterate through all units in that array
for i, v in ipairs(unitsNearTower) do
-- Change the stats for the unit selected by the iterator (stored in "v") by
-- increasing its attack by 20 points for 5 seconds
changeUnitStats(v, 'attack', 20, 5)
end
resetTimerEvent(triggeredTimerEventId()) -- Reset the timer
end
end
</timerTriggerEvent>
</map>

To summarize what happens above, we tell the engine that we have one neutral faction (glestimals) and we load in a particle file for use later. We do this because the engine must know what it needs to load when starting a game.
We then load in a model and place it in the center of this map (assuming the map is 128 x 128). The tower is active, so it is displayed by default. Since no cell map is specified, it defaults to non-walkable for all cells, which is fine for a square tower (although a round tower would want to use a cell map). We then apply the previously loaded particles to this tower. Maybe the particles are some beam shooting up from the tower, making it look all dramatic looking (kinda like
this).
Finally, we draw a region around the tower. The tower is a 10 x 10 square, and the region is the 20 x 20 square around that, meaning it's the walkable area up to (approximately) 5 cells from the tower. We'll use this area so we can boost the stats of units inside it. The picture to the left shows the placement in detail. Note the placement isn't
exact, since models are placed based on the center of the model, and there's no tile that's *exactly* in the center of a 10 x 10 model, so we use one shifted up and left.
Now the startup element should look familiar, since it functions the same way as in scenarios. It creates a timer, which we'll use to check for units inside the region. We also create a single bear from the glestimal faction and place it near the tower.
The timer trigger element is also the same as in scenarios, and should look familiar to those who've used timers in scenarios. It first checks if the triggered timer is the correct one (not actually needed since we only have one timer), then checks if enough time has passed (in this case, it triggers in intervals of two seconds). When the timer triggers, it gets the array of units in the region and iterates through this array, boosting the stats of all those units. Thus, all units near the tower get a small boost to their attack. Finally, we reset the timer, since this is a reoccuring event.
Hopefully this example sheds more light on the potential of this proposal.