function Trig__map_header_Actions takes nothing returns nothing
endfunction
//===========================================================================
function InitTrig__map_header takes nothing returns nothing
set gg_trg__map_header = CreateTrigger( )
call TriggerAddAction( gg_trg__map_header, function Trig__map_header_Actions )
endfunction
function TerrainChangeInRect takes nothing returns nothing
local real minx = GetRectMinX(gg_rct_TERRAIN_1) // Replace YOURRECT with the name of your rect. Blanks must be replaced with _
local real miny = GetRectMinY(gg_rct_TERRAIN_1) // e.g. gg_rct_Rect_Change
local real maxx = GetRectMaxX(gg_rct_TERRAIN_1)
local real maxy = GetRectMaxY(gg_rct_TERRAIN_1)
local real x=minx
local real y=maxy
local integer TType
loop
exitwhen y<miny
loop
exitwhen x>maxx
set TType = GetTerrainType(x, y)
if TType == 'Lgrs' then // 'Ldrt' is the TerrainType-Id that should be found
call SetTerrainType(x, y, 'Dgrs', -1, 1, 0)
// 'Nice' ist the TerrainType-Id that will replace 'Ldrt
elseif TType == 'Lgrd' then
// use more elseif's to add more terrain types that can be found in the rect and replace them with other ones
call SetTerrainType(x, y, 'Bdsr', -1, 1, 0)
endif
set x=x+128
endloop
set x=minx
set y=y-128.0
call TriggerSleepAction(0.01) // The wait could be needed to prevent a small lag and to make the terrain completely change if the rect is too big
endloop
endfunction