- Joined
- Dec 13, 2018
- Messages
- 2,368
Hello Hive
So I have encountered a problem while trying to change the terrain in my map through triggers/scripts.
I have used all 16 tiles, so I thought I could just change the terrain through triggers but it still just changes to an already existing terrain type.
First I tried this:
Then I tried this:
Both of the attempts changes the terrain to an already existing terrain type.
Do you know of any way at all to exceed the 16 tile limit?
So I have encountered a problem while trying to change the terrain in my map through triggers/scripts.
I have used all 16 tiles, so I thought I could just change the terrain through triggers but it still just changes to an already existing terrain type.
First I tried this:
-
GUI
-
Events
-
Player - Player 1 (Red) types a chat message containing 1 as An exact match
-
-
Conditions
-
Actions
-
Environment - Change terrain type at (Center of Region 000 <gen>) to Cityscape - Grass Trim using variation -1 in an area of size 5 and shape Circle
-
-
Then I tried this:
Code:
function TerrainChangeInRect takes rect r returns nothing
local real minx = GetRectMinX(r)
local real miny = GetRectMinY(r)
local real maxx = GetRectMaxX(r)
local real maxy = GetRectMaxY(r)
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 == 'Ldrt' then // 'Ldrt' is the TerrainType-Id that should be found
call SetTerrainType(x, y, 'Jsqd', -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, 'Jsqd', -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
-
JASS
-
Events
-
Player - Player 1 (Red) types a chat message containing 2 as An exact match
-
-
Conditions
-
Actions
-
Custom script: call TerrainChangeInRect(gg_rct_Region_000)
-
-
Both of the attempts changes the terrain to an already existing terrain type.
Do you know of any way at all to exceed the 16 tile limit?