System Replace Terrain

Romek

Super Moderator
Reaction score
963
Terrain Replacement System

Requires a vJass preprocessor

Most of it is just a single function, which replaces a terrain type with another, in game.

The functions:
JASS:
function ReplaceTerrainTypeEx takes integer OldTerrain, integer NewTerrain, rect WhichRect returns nothing

OldTerrain and NewTerrain are the Id's of the Terrain. (For example: 'Nice' (Northrend, Ice))
NewTerrain Replaces OldTerrain.
WhichRect is the rect in which the terrain will be replaced.

JASS:
function ReplaceGlobalTerrain takes integer OldTerrain, integer NewTerrain returns nothing

This is a simpler version of the above. It replaces terrain Globally, and therefore, only takes 2 arguments.

JASS:
function ReplaceGlobalTerrainReversed takes integer NewTerrain, integer OldTerrain returns nothing

Similar to the version without 'reversed' on the end. This makes it easier to change terrain back to what it was. (It's easier to add a "Reversed" to the function name, than to change the order of the arguments)

The Uses:
If you want to have seasons or some sort of weather in your map, you can use this to change the terrain type as well as having the weather effect. It's also useful for dynamically changing complete areas.

A sample of this is in the test map.

Note that the 16-tile limit still exists.

How to use the Terrain Constants:
Instead of finding out what the Raw Code for the terrain you want is, you can simply use the Global Constants created by Darthfett.
To use them, use TILESET_TILE in place of the raw code.
For example:
JASS:
ReplaceGlobalTerrain(LORDAERONSUMMER_DIRT, DUNGEON_DIRT)

this will replace Lordaeron Summer dirt with Outland dirt.

The Code:
JASS:
//                  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
//                  -=-=-=  Terrain Replacement Functions by Romek V4  =-=-=- 
// +-----------------=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-----------------------------+ 
// | -=-= Functions: =-=-                                                                                |
// | ReplaceTerrainTypeEx takes integer OldTerrain, integer NewTerrain, rect WhichRect                   |
// | OldTerrain and NewTerrain are the ID's of the terrain you want to Replace. New replaces Old.        |
// | WhichRect is the rect in which the terrain will be replaced.                                        |
// +-----------------------------------------------------------------------------------------------------+
// | ReplaceGlobalTerrain and ReplaceGlobalTerrainReversed are shorter versions of ReplaceTerrainTypeEx. |
// | They only take the 2 terrain types, and will affect the entire map, replacing Old, with New.        |
// | The 'Reversed' version is there so it's easier to switch back to the old terrain without having to  |
// | change the order of the arguments (You just need to Copy and Paste the "Reversed" after the         |
// | function name!                                                                                      |
// +-----------------------------------------------------------------------------------------------------+
// | -=-= Version History: =-=-                                                                          |
// | Version 1:                                                                                          |
// |  - Created TRF - Didn't work on maps larger than 32x32                                              |
// |                                                                                                     |
// | Version 1.5:                                                                                        |
// |  - Made compatible for all map sizes, However, could take over 20 seconds to completely change      |
// |    the terrain on some maps.                                                                        |
// |  - Tried timers, Worked well, with a short code, but took a few minutes to change large maps.       |
// |                                                                                                     |
// | Version 2:                                                                                          |
// |  - Remade the entire System, using Function.Execute. Works instantly for all map sizes now, the     |
// |    code is also short, although a LagSpike may occur when used.                                     |
// |                                                                                                     |
// | Version 2.5:                                                                                        |
// |  - Shortened code by a massive amount by doing some simple loops                                    |
// |  - Now works for all map sizes, up to 480x480.                                                      |
// |                                                                                                     |
// | Version 3:                                                                                          |
// |  - Fixed a major bug involving rects nor changing properly                                          |
// |  - Optimized and shortened the code even more                                                       |
// |                                                                                                     |
// | Version 4:                                                                                          |
// |  - Fixed a leak, and removed a pointless function                                                   |
// +-----------------------------------------------------------------------------------------------------+
// | Credit isn't needed if used.                                                                        |
// +-----------------------------------------------------------------------------------------------------+
library ReplaceTerrain initializer Init

    globals
       rect bj_worldBounds
       private real WBMaX
       private real WBMaY
       private real WBMiX
       private real WBMiY
    endglobals
    
    private function SubFunctionB takes real minX, real maxX, real y, integer oldTerrain, integer terrain returns nothing
        loop
            exitwhen minX > maxX
                if GetTerrainType(minX, y) == oldTerrain then
                    call SetTerrainType(minX, y, terrain, -1, 1, 1)
                endif
            set minX = minX + 128
        endloop
    endfunction
    
    private function SubFunctionA takes integer oldTerrain, integer newTerrain, real minX, real maxX, real minY, real maxY returns nothing
        loop
            exitwhen minY > maxY
                call SubFunctionB.execute(minX, maxX, minY, oldTerrain, newTerrain)
            set minY = minY + 128
        endloop
    endfunction
        
    function ReplaceTerrainTypeEx takes integer oldTerrain, integer newTerrain, rect whichRect returns nothing
        call SubFunctionA.execute(oldTerrain, newTerrain, GetRectMinX(whichRect), GetRectMaxX(whichRect), GetRectMinY(whichRect), GetRectMaxY(whichRect))
    endfunction

    function ReplaceGlobalTerrain takes integer oldTerrain, integer newTerrain returns nothing
        call SubFunctionA.execute(oldTerrain, newTerrain, WBMiX, WBMaX, WBMiY, WBMaY)
    endfunction
    
    function ReplaceGlobalTerrainReversed takes integer newTerrain, integer oldTerrain returns nothing
        call SubFunctionA.execute(oldTerrain, newTerrain, WBMiX, WBMaX, WBMiY, WBMaY)
    endfunction
    
    private function Init takes nothing returns nothing
        set bj_worldBounds = GetWorldBounds()
        set WBMaX = GetRectMaxX(bj_worldBounds)
        set WBMiX = GetRectMinX(bj_worldBounds)
        set WBMaY = GetRectMaxY(bj_worldBounds)
        set WBMiY = GetRectMinY(bj_worldBounds)
    endfunction
    
endlibrary


Note: The Minimap doesn't change to the correct terrain when this is used.

The Map: (Terrain-Type list included in the map)
 

Attachments

  • [Snippet] Change Terrain Types5.w3m
    24.9 KB · Views: 524

Forty

New Member
Reaction score
6
Ah nice, now youre starting the functions in different threads which avoids the op limit hit. good job on this, +rep for you.
 

Romek

Super Moderator
Reaction score
963
Ah nice, now youre starting the functions in different threads which avoids the op limit hit. good job on this, +rep for you.

Yes, instead of doing a single loop which fails.

And thanks.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Very good, very good indeed. Too bad I didn't see this earlier, because I was in need of such a thing. After all, I made my own terrain replacement function... +rep for this.
A tip: maybe you could add a comment with all the terrain types?
 

Romek

Super Moderator
Reaction score
963
Very good, very good indeed. Too bad I didn't see this earlier, because I was in need of such a thing. After all, I made my own terrain replacement function... +rep for this.
A tip: maybe you could add a comment with all the terrain types?

Thanks :)

Man.. Listing all the terrain types is going to take ages... But ok. I need to kill some time.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
> Man.. Listing all the terrain types is going to take ages
I know, but this makes it easier for the users. It took me a few minutes to search all types, convert them from GUI to JASS and then copy... It would be like the TimedLightning system - it has a list of all lightning raw codes.
 

Romek

Super Moderator
Reaction score
963
JASS:
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-= List of Terrain Types =-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

// Lordaeron Summer
'Ldrt' = Lordaeron Summer - Dirt
'Ldro' = Lordaeron Summer - Rough Dirt
'Ldrg' = ordaeron Summer - Grassy Dirt
'Lrok' = Lordaeron Summer - Rock
'Lgrs' = Lordaeron Summer - Grass
'Lgrd' = Lordaeron Summer - Dark Grass

// Lordaeron Fall
'Fdrt' = Lordaeron Fall - Dirt
'Fdro' = Lordaeron Fall - Rough Dirt
'Fdrg' = Lordaeron Fall - Grassy Dirt
'Frok' = Lordaeron Fall - Rock
'Fgrs' = Lordaeron Fall - Grass
'Fgrd' = Lordaeron Fall - Dark Grass

// Lordaeron Winter
'Wdrt' = Lordaeron Winter - Dirt
'Wdro' = Lordaeron Winter - Rough Dirt
'Wsng' = Lordaeron Winter - Grassy Snow
'Wrok' = Lordaeron Winter - Rock
'Wgrs' = Lordaeron Winter - Grass
'Wsnw' = Lordaeron Winter - Snow

// Barrens
'Bdrt' = Barrens - Dirt
'Bdrh' = Barrens - Rough Dirt
'Bdrr' = BarrensPebbles
'Bdrg' = Barrens - Grassy Dirt
'Bdsr' = Barrens - Desert
'Bdsd' = Barrens - Dark Desert
'Bflr' = Barrens - Rock
'Bgrr' = Barrens - Grass

// Ashenvale
'Adrt' = Ashenvale - Dirt
'Adrd' = Ashenvale - Rough Dirt
'Agrs' = Ashenvale - Grass
'Arck' = Ashenvale - Rock
'Agrd' = Ashenvale - Lumpy Grass
'Avin' = Ashenvale - Vines
'Adrg' = Ashenvale - Grassy Dirt
'Alvd' = Ashenvale - Leaves

// Felwood
'Cdrt' = Felwood - Dirt
'Cdrd' = Felwood - Rough Dirt
'Cpos' = Felwood - Poison
'Crck' = Felwood - Rock
'Cvin' = Felwood - Vines
'Cgrs' = Felwood - Grass
'Clvg' = Felwood - Leaves

// Northrend
'Ndrt' = Northrend - Dirt
'Ndrd' = Northrend - Dark Dirt
'Nrck' = Northrend - Rock
'Ngrs' = Northrend - Grass
'Nice' = Northrend - Ice
'Nsnw' = Northrend - Snow
'Nsnr' = Northrend - Rocky Snow

// Cityscape
'Ydrt' = Cityscape - Dirt
'Ydtr' = Cityscape - Rough Dirt
'Yblm' = Cityscape - Black Marble
'Ybtl' = Cityscape - Brick
'Ysqd' = Cityscape - Square Tiles
'Yrtl' = Cityscape - Round Tiles
'Ygsb' = Cityscape - Grass
'Yhdg' = Cityscape - Grass Trim
'Ywmb' = Cityscape - White Marble

// Village
'Vdrt' = Village - Dirt
'Vdrr' = Village - Rough Dirt
'Vcrp' = Village - Crops
'Vcbp' = Village - Cobble Path
'Vstp' = Village - Stone Path
'Vgrs' = Village - Short Grass
'Vrck' = Village - Rocks
'Vgrt' = Village - Thick Grass

// Village Fall
'Qdrt' = Village Fall - Dirt
'Qdrr' = Village Fall - Rough Dirt
'Qcrp' = Village Fall - Crops
'Qcbp' = Village Fall - Cobble Path
'Qstp' = Village Fall - Stone Path
'Qgrs' = Village Fall - Short Grass
'Qrck' = Village Fall - Rocks
'Qgrt' = Village Fall - Thick Grass

// Dalaran
'Xdrt' = Dalaran - Dirt
'Xdtr' = Dalaran - Rough Dirt
'Xblm' = Dalaran - Black Marble
'Xbtl' = Dalaran - Brick Tiles
'Xsqd' = Dalaran - Square Tiles
'Xrtl' = Dalaran - Round Tiles
'Xgsb' = Dalaran - Grass
'Xhdg' = Dalaran - Trim Grass
'Xwmb' = Dalaran - White Marble

// Dungeon
'Ddrt' = Dungeon - Dirt
'Dbrk' = Dungeon - Brick
'Drds' = Dungeon - Red Stones
'Dlvc' = Dungeon - Lava Cracks
'Dlav' = Dungeon - Lava
'Ddkr' = Dungeon - Dark Rocks
'Dgrs' = Dungeon - Grey Stones
'Dsqd' = Dungeon - Square Tiles

// Underground
'Gdrt' = Underground - Dirt
'Gbrk' = Underground - Brick
'Grds' = Underground - Red Stones
'Glvc' = Underground - Lava Cracks
'Glav' = Underground - Lava
'Gdkr' = Underground - Dark Rocks
'Ggrs' = Underground - Grey Stones
'Gsqd' = Underground - Square Tiles

// Sunken Ruins
'Zdrt' = Sunken Ruins - Dirt
'Zdtr' = Sunken Ruins - Rough Dirt
'Zdrg' = Sunken Ruins - Grassy Dirt
'Zbks' = Sunken Ruins - Small Bricks
'Zsan' = Sunken Ruins - Sand
'Zbkl' = Sunken Ruins - Large Bricks
'Ztil' = Sunken Ruins - Round Tiles
'Zgrs' = Sunken Ruins - Grass
'Zvin' = Sunken Ruins - Dark Grass

// Icecrown Glacier
'Idrt' = Icecrown Glacier - Dirt
'Idtr' = Icecrown Glacier - Rough Dirt
'Idki' = Icecrown Glacier - Dark Ice
'Ibkb' = Icecrown Glacier - Black Bricks
'Irbk' = Icecrown Glacier - Rune Bricks
'Itbk' = Icecrown Glacier - Tiled Bricks
'Iice' = Icecrown Glacier - Ice
'Ibsq' = Icecrown Glacier - Black Squares
'Isnw' = Icecrown Glacier - Snow

// Outland
'Odrt' = Outland - Dirt
'Odtr' = Outland - Light Dirt
'Osmb' = Outland - Rough Dirt
'Ofst' = Outland - Cracked Dirt
'Olgb' = Outland - Flat Stones
'Orok' = Outland - Rock
'Ofsl' = Outland - Light Flat Stones
'Oaby' = Outland - Abyss


// Black Citadel
'Kdrt' = Black Citadel - Dirt
'Kfsl' = Black Citadel - Light Dirt
'Kdtr' = Black Citadel - Rough Dirt
'Kfst' = Black Citadel - Flat Stones
'Ksmb' = Black Citadel - Small Bricks
'Klgb' = Black Citadel - Large Bricks
'Ksqt' = Black Citadel - Square Tiles
'Kdkt' = Black Citadel - Dark Tiles

// Dalaran Ruins
'Jdrt' = Dalaran Ruins - Dirt
'Jdtr' = Dalaran Ruins - Rough Dirt
'Jblm' = Dalaran Ruins - Black Marble
'Jbtl' = Dalaran Ruins - Brick Tiles
'Jsqd' = Dalaran Ruins - Square Tiles
'Jrtl' = Dalaran Ruins - Round Tiles
'Jgsb' = Dalaran Ruins - Grass
'Jhdg' = Dalaran Ruins - Trim Grass
'Jwmb' = Dalaran Ruins - White Marble

// Cliffs
'cAc2' = Ashenvale - Dirt Cliff
'cAc1' = Ashenvale - Grass Cliff
'cBc2' = Barrens - Desert Cliff
'cBc1' = Barrens - Grass Cliff
'cKc1' = Black Citadel - Dirt Cliff
'cKc2' = Black Citadel - Dark Tiles Cliff
'cYc2' = Cityscape - Dirt Cliff
'cYc1' = Cityscape - Square Tiles Cliff
'cXc2' = Dalaran - Dirt Cliff
'cXc1' = Dalaran - Square Tiles Cliff
'cJc2' = Dalaran Ruins - Dirt Cliff
'cJc1' = Dalaran Ruins - Square Tiles Cliff
'cDc2' = Dungeon - Dirt Cliff
'cDc1' = Dungeon - Square Tiles Cliff
'cCc2' = Felwood - Dirt Cliff
'cCc1' = Felwood - Grass Cliff
'cIc2' = Icecrown Glacier - Rune Bricks Cliff
'cIc1' = Icecrown Glacier - Snow Cliff
'cFc2' = Lordaeron Fall - Dirt Cliff
'cFc1' = Lordaeron Fall - Grass Cliff
'cLc2' = Lordaeron Summer - Dirt Cliff
'cLc1' = Lordaeron Summer - Grass Cliff
'cWc2' = Lordaeron Winter - Grass Cliff
'cWc1' = Lordaeron Winter - Snow Cliff
'cNc2' = Northrend - Dirt Cliff
'cNc1' = Northrend - Snow Cliff
'cOc1' = Outland - Abyss Cliff
'cOc2' = Outland - Rough Dirt Cliff
'cZc2' = Sunken Ruins - Dirt Cliff
'cZc1' = Sunken Ruins - Large Bricks Cliff
'cGc2' = Underground - Dirt Cliff
'cGc1' = Underground - Square Tiles Cliff
'cVc2' = Village - Dirt Cliff
'cVc1' = Village - Grass Thick Cliff
'cQc2' = Village Fall - Dirt Cliff
'cQc1' = Village Fall - Grass Thick Cliff
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Here's a vJASS formatted set of globals. I organized them. :p

JASS:
library TTs

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-= List of Terrain Types =-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-= Thanks to Romek  -=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
scope LORDAERONSUMMER
// Lordaeron Summer
globals
    public constant integer DIRT = 'Ldrt'
    public constant integer ROUGH_DIRT = 'Ldro'
    public constant integer GRASSY_DIRT = 'Ldrg'
    public constant integer ROCK = 'Lrok'
    public constant integer GRASS = 'Lgrs'
    public constant integer DARK_GRASS = 'Lgrd'
    public constant integer DIRT_CLIFF = 'cLc2'
    public constant integer GRASS_CLIFF = 'cLc1'
endglobals

endscope

scope LORDAERONFALL
// Lordaeron Fall
globals
    public constant integer DIRT = 'Fdrt'
    public constant integer ROUGH_DIRT = 'Fdro'
    public constant integer GRASSY_DIRT = 'Fdrg'
    public constant integer ROCK = 'Frok'
    public constant integer GRASS = 'Fgrs'
    public constant integer DARK_GRASS = 'Fgrd'
    public constant integer DIRT_CLIFF = 'cFc2'
    public constant integer GRASS_CLIFF = 'cFc1'
endglobals

endscope

scope LORDAERONWINTER
// Lordaeron Winter
globals
    public constant integer DIRT = 'Wdrt'
    public constant integer ROUGH_DIRT = 'Wdro'
    public constant integer GRASSY_SNOW = 'Wsng'
    public constant integer ROCK = 'Wrok'
    public constant integer GRASS = 'Wgrs'
    public constant integer SNOW = 'Wsnw'
    public constant integer GRASS_CLIFF = 'cWc2'
    public constant integer SNOW_CLIFF = 'cWc1'
endglobals

endscope

scope BARRENS
// Barrens
globals
    public constant integer DIRT = 'Bdrt'
    public constant integer ROUGH_DIRT = 'Bdrh'
    public constant integer PEBBLES = 'Bdrr'
    public constant integer GRASSY_DIRT = 'Bdrg'
    public constant integer DESERT = 'Bdsr'
    public constant integer DARK_DESERT = 'Bdsd'
    public constant integer ROCK = 'Bflr'
    public constant integer GRASS = 'Bgrr'
    public constant integer DESERT_CLIFF = 'cBc2'
    public constant integer GRASS_CLIFF = 'cBc1'
endglobals

endscope

scope ASHENVALE
// Ashenvale
globals
    public constant integer DIRT = 'Adrt'
    public constant integer ROUGH_DIRT = 'Adrd'
    public constant integer GRASS = 'Agrs'
    public constant integer ROCK = 'Arck'
    public constant integer LUMPY_GRASS = 'Agrd'
    public constant integer VINES = 'Avin'
    public constant integer GRASSY_DIRT = 'Adrg'
    public constant integer LEAVES = 'Alvd'
    public constant integer DIRT_CLIFF = 'cAc2'
    public constant integer GRASS_CLIFF = 'cAc1'
endglobals

endscope

scope FELWOOD
// Felwood
globals
    public constant integer DIRT = 'Cdrt'
    public constant integer ROUGH_DIRT = 'Cdrd'
    public constant integer POISON = 'Cpos'
    public constant integer ROCK = 'Crck'
    public constant integer VINES = 'Cvin'
    public constant integer GRASS = 'Cgrs'
    public constant integer LEAVES = 'Clvg'
    public constant integer DIRT_CLIFF = 'cCc2'
    public constant integer GRASS_CLIFF = 'cCc1'
endglobals

endscope

scope NORTHREND
// Northrend
globals
    public constant integer DIRT = 'Ndrt'
    public constant integer DARK_DIRT = 'Ndrd'
    public constant integer ROCK = 'Nrck'
    public constant integer GRASS = 'Ngrs'
    public constant integer ICE = 'Nice'
    public constant integer SNOW = 'Nsnw'
    public constant integer ROCKY_SNOW = 'Nsnr'
    public constant integer DIRT_CLIFF = 'cNc2'
    public constant integer SNOW_CLIFF = 'cNc1'
endglobals

endscope

scope CITYSCAPE
// Cityscape
globals
    public constant integer DIRT = 'Ydrt'
    public constant integer ROUGH_DIRT = 'Ydtr'
    public constant integer BLACK_MARBLE = 'Yblm'
    public constant integer BRICK = 'Ybtl'
    public constant integer SQUARE_TILES = 'Ysqd'
    public constant integer ROUND_TILES = 'Yrtl'
    public constant integer GRASS = 'Ygsb'
    public constant integer GRASS_TRIM = 'Yhdg'
    public constant integer WHITE_MARBLE = 'Ywmb'
    public constant integer DIRT_CLIFF = 'cYc2'
    public constant integer SQUARE_TILES_CLIFF = 'cYc1'
endglobals

endscope

scope VILLAGE
// Village
globals
    public constant integer DIRT = 'Vdrt'
    public constant integer ROUGH_DIRT = 'Vdrr'
    public constant integer CROPS = 'Vcrp'
    public constant integer COBBLE_PATH = 'Vcbp'
    public constant integer STONE_PATH = 'Vstp'
    public constant integer SHORT_GRASS = 'Vgrs'
    public constant integer ROCKS = 'Vrck'
    public constant integer THICK_GRASS = 'Vgrt'
    public constant integer DIRT_CLIFF = 'cVc2'
    public constant integer GRASS_THICK_CLIFF = 'cVc1'
endglobals

endscope

scope VILLAGEFALL
// Village Fall
globals
    public constant integer DIRT = 'Qdrt'
    public constant integer ROUGH_DIRT = 'Qdrr'
    public constant integer CROPS = 'Qcrp'
    public constant integer COBBLE_PATH = 'Qcbp'
    public constant integer STONE_PATH = 'Qstp'
    public constant integer SHORT_GRASS = 'Qgrs'
    public constant integer ROCKS = 'Qrck'
    public constant integer THICK_GRASS = 'Qgrt'
    public constant integer DIRT_CLIFF = 'cQc2'
    public constant integer GRASS_THICK_CLIFF = 'cQc1'
endglobals

endscope

scope DALARAN
// Dalaran
globals
    public constant integer DIRT = 'Xdrt'
    public constant integer ROUGH_DIRT = 'Xdtr'
    public constant integer BLACK_MARBLE = 'Xblm'
    public constant integer BRICK_TILES = 'Xbtl'
    public constant integer SQUARE_TILES = 'Xsqd'
    public constant integer ROUND_TILES = 'Xrtl'
    public constant integer GRASS = 'Xgsb'
    public constant integer TRIM_GRASS = 'Xhdg'
    public constant integer WHITE_MARBLE = 'Xwmb'
    public constant integer DIRT_CLIFF = 'cXc2'
    public constant integer SQUARE_TILES_CLIFF = 'cXc1'
endglobals

endscope

scope DUNGEON
// Dungeon
globals
    public constant integer DIRT = 'Ddrt'
    public constant integer BRICK = 'Dbrk'
    public constant integer RED_STONES = 'Drds'
    public constant integer LAVA_CRACKS = 'Dlvc'
    public constant integer LAVA = 'Dlav'
    public constant integer DARK_ROCKS = 'Ddkr'
    public constant integer GREY_STONES = 'Dgrs'
    public constant integer SQUARE_TILES = 'Dsqd'
    public constant integer DIRT_CLIFF = 'cDc2'
    public constant integer SQUARE_TILES_CLIFF = 'cDc1'
endglobals

endscope

scope UNDERGROUND
// Underground
globals
    public constant integer DIRT = 'Gdrt'
    public constant integer BRICK = 'Gbrk'
    public constant integer RED_STONES = 'Grds'
    public constant integer LAVA_CRACKS = 'Glvc'
    public constant integer LAVA = 'Glav'
    public constant integer DARK_ROCKS = 'Gdkr'
    public constant integer GREY_STONES = 'Ggrs'
    public constant integer SQUARE_TILES = 'Gsqd'
    public constant integer DIRT_CLIFF = 'cGc2'
    public constant integer SQUARE_TILES_CLIFF = 'cGc1'
endglobals

endscope

scope SUNKENRUINS
// Sunken Ruins
globals
    public constant integer DIRT = 'Zdrt'
    public constant integer ROUGH_DIRT = 'Zdtr'
    public constant integer GRASSY_DIRT = 'Zdrg'
    public constant integer SMALL_BRICKS = 'Zbks'
    public constant integer SAND = 'Zsan'
    public constant integer LARGE_BRICKS = 'Zbkl'
    public constant integer ROUND_TILES = 'Ztil'
    public constant integer GRASS = 'Zgrs'
    public constant integer DARK_GRASS = 'Zvin'
    public constant integer DIRT_CLIFF = 'cZc2'
    public constant integer LARGE_BRICKS_CLIFF = 'cZc1'
endglobals

endscope

scope ICECROWNGLACIER
// Icecrown Glacier
globals
    public constant integer DIRT = 'Idrt'
    public constant integer ROUGH_DIRT = 'Idtr'
    public constant integer DARK_ICE = 'Idki'
    public constant integer BLACK_BRICKS = 'Ibkb'
    public constant integer RUNE_BRICKS = 'Irbk'
    public constant integer TILED_BRICKS = 'Itbk'
    public constant integer ICE = 'Iice'
    public constant integer BLACK_SQUARES = 'Ibsq'
    public constant integer SNOW = 'Isnw'
    public constant integer RUNE_BRICKS_CLIFF = 'cIc2'
    public constant integer SNOW_CLIFF = 'cIc1'
endglobals

endscope

scope OUTLAND
// Outland
globals
    public constant integer DIRT = 'Odrt'
    public constant integer LIGHT_DIRT = 'Odtr'
    public constant integer ROUGH_DIRT = 'Osmb'
    public constant integer CRACKED_DIRT = 'Ofst'
    public constant integer FLAT_STONES = 'Olgb'
    public constant integer ROCK = 'Orok'
    public constant integer LIGHT_FLAT_STONES = 'Ofsl'
    public constant integer ABYSS = 'Oaby'
    public constant integer ABYSS_CLIFF = 'cOc1'
    public constant integer ROUGH_DIRT_CLIFF = 'cOc2'
endglobals

endscope

scope BLACKCITADEL
// Black Citadel
globals
    public constant integer DIRT = 'Kdrt'
    public constant integer LIGHT_DIRT = 'Kfsl'
    public constant integer ROUGH_DIRT = 'Kdtr'
    public constant integer FLAT_STONES = 'Kfst'
    public constant integer SMALL_BRICKS = 'Ksmb'
    public constant integer LARGE_BRICKS = 'Klgb'
    public constant integer SQUARE_TILES = 'Ksqt'
    public constant integer DARK_TILES = 'Kdkt'
    public constant integer DIRT_CLIFF = 'cKc1'
    public constant integer DARK_TILES_CLIFF = 'cKc2'
endglobals

endscope

scope DALARANRUINS
// Dalaran Ruins
globals
    public constant integer DIRT = 'Jdrt'
    public constant integer ROUGH_DIRT = 'Jdtr'
    public constant integer BLACK_MARBLE =  'Jblm'
    public constant integer BRICK_TILES = 'Jbtl'
    public constant integer SQUARE_TILES = 'Jsqd'
    public constant integer ROUND_TILES = 'Jrtl'
    public constant integer GRASS = 'Jgsb'
    public constant integer TRIM_GRASS = 'Jhdg'
    public constant integer WHITE_MARBLE = 'Jwmb'
    public constant integer DIRT_CLIFF = 'cJc2'
    public constant integer SQUARE_TILES_CLIFF = 'cJc1'
endglobals

endscope

endlibrary


EDIT:

Also, just to let you know, you forgot the comment/header for Sunken Ruins in your list. :p
 

Romek

Super Moderator
Reaction score
963
Here's a vJASS formatted set of globals. I organized them. :p

JASS:
library TTs

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-= List of Terrain Types =-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-= Thanks to Romek  -=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
scope LORDAERONSUMMER
// Lordaeron Summer
globals
    public constant integer DIRT = 'Ldrt'
    public constant integer ROUGH_DIRT = 'Ldro'
    public constant integer GRASSY_DIRT = 'Ldrg'
    public constant integer ROCK = 'Lrok'
    public constant integer GRASS = 'Lgrs'
    public constant integer DARK_GRASS = 'Lgrd'
    public constant integer DIRT_CLIFF = 'cLc2'
    public constant integer GRASS_CLIFF = 'cLc1'
endglobals

endscope

scope LORDAERONFALL
// Lordaeron Fall
globals
    public constant integer DIRT = 'Fdrt'
    public constant integer ROUGH_DIRT = 'Fdro'
    public constant integer GRASSY_DIRT = 'Fdrg'
    public constant integer ROCK = 'Frok'
    public constant integer GRASS = 'Fgrs'
    public constant integer DARK_GRASS = 'Fgrd'
    public constant integer DIRT_CLIFF = 'cFc2'
    public constant integer GRASS_CLIFF = 'cFc1'
endglobals

endscope

scope LORDAERONWINTER
// Lordaeron Winter
globals
    public constant integer DIRT = 'Wdrt'
    public constant integer ROUGH_DIRT = 'Wdro'
    public constant integer GRASSY_SNOW = 'Wsng'
    public constant integer ROCK = 'Wrok'
    public constant integer GRASS = 'Wgrs'
    public constant integer SNOW = 'Wsnw'
    public constant integer GRASS_CLIFF = 'cWc2'
    public constant integer SNOW_CLIFF = 'cWc1'
endglobals

endscope

scope BARRENS
// Barrens
globals
    public constant integer DIRT = 'Bdrt'
    public constant integer ROUGH_DIRT = 'Bdrh'
    public constant integer PEBBLES = 'Bdrr'
    public constant integer GRASSY_DIRT = 'Bdrg'
    public constant integer DESERT = 'Bdsr'
    public constant integer DARK_DESERT = 'Bdsd'
    public constant integer ROCK = 'Bflr'
    public constant integer GRASS = 'Bgrr'
    public constant integer DESERT_CLIFF = 'cBc2'
    public constant integer GRASS_CLIFF = 'cBc1'
endglobals

endscope

scope ASHENVALE
// Ashenvale
globals
    public constant integer DIRT = 'Adrt'
    public constant integer ROUGH_DIRT = 'Adrd'
    public constant integer GRASS = 'Agrs'
    public constant integer ROCK = 'Arck'
    public constant integer LUMPY_GRASS = 'Agrd'
    public constant integer VINES = 'Avin'
    public constant integer GRASSY_DIRT = 'Adrg'
    public constant integer LEAVES = 'Alvd'
    public constant integer DIRT_CLIFF = 'cAc2'
    public constant integer GRASS_CLIFF = 'cAc1'
endglobals

endscope

scope FELWOOD
// Felwood
globals
    public constant integer DIRT = 'Cdrt'
    public constant integer ROUGH_DIRT = 'Cdrd'
    public constant integer POISON = 'Cpos'
    public constant integer ROCK = 'Crck'
    public constant integer VINES = 'Cvin'
    public constant integer GRASS = 'Cgrs'
    public constant integer LEAVES = 'Clvg'
    public constant integer DIRT_CLIFF = 'cCc2'
    public constant integer GRASS_CLIFF = 'cCc1'
endglobals

endscope

scope NORTHREND
// Northrend
globals
    public constant integer DIRT = 'Ndrt'
    public constant integer DARK_DIRT = 'Ndrd'
    public constant integer ROCK = 'Nrck'
    public constant integer GRASS = 'Ngrs'
    public constant integer ICE = 'Nice'
    public constant integer SNOW = 'Nsnw'
    public constant integer ROCKY_SNOW = 'Nsnr'
    public constant integer DIRT_CLIFF = 'cNc2'
    public constant integer SNOW_CLIFF = 'cNc1'
endglobals

endscope

scope CITYSCAPE
// Cityscape
globals
    public constant integer DIRT = 'Ydrt'
    public constant integer ROUGH_DIRT = 'Ydtr'
    public constant integer BLACK_MARBLE = 'Yblm'
    public constant integer BRICK = 'Ybtl'
    public constant integer SQUARE_TILES = 'Ysqd'
    public constant integer ROUND_TILES = 'Yrtl'
    public constant integer GRASS = 'Ygsb'
    public constant integer GRASS_TRIM = 'Yhdg'
    public constant integer WHITE_MARBLE = 'Ywmb'
    public constant integer DIRT_CLIFF = 'cYc2'
    public constant integer SQUARE_TILES_CLIFF = 'cYc1'
endglobals

endscope

scope VILLAGE
// Village
globals
    public constant integer DIRT = 'Vdrt'
    public constant integer ROUGH_DIRT = 'Vdrr'
    public constant integer CROPS = 'Vcrp'
    public constant integer COBBLE_PATH = 'Vcbp'
    public constant integer STONE_PATH = 'Vstp'
    public constant integer SHORT_GRASS = 'Vgrs'
    public constant integer ROCKS = 'Vrck'
    public constant integer THICK_GRASS = 'Vgrt'
    public constant integer DIRT_CLIFF = 'cVc2'
    public constant integer GRASS_THICK_CLIFF = 'cVc1'
endglobals

endscope

scope VILLAGEFALL
// Village Fall
globals
    public constant integer DIRT = 'Qdrt'
    public constant integer ROUGH_DIRT = 'Qdrr'
    public constant integer CROPS = 'Qcrp'
    public constant integer COBBLE_PATH = 'Qcbp'
    public constant integer STONE_PATH = 'Qstp'
    public constant integer SHORT_GRASS = 'Qgrs'
    public constant integer ROCKS = 'Qrck'
    public constant integer THICK_GRASS = 'Qgrt'
    public constant integer DIRT_CLIFF = 'cQc2'
    public constant integer GRASS_THICK_CLIFF = 'cQc1'
endglobals

endscope

scope DALARAN
// Dalaran
globals
    public constant integer DIRT = 'Xdrt'
    public constant integer ROUGH_DIRT = 'Xdtr'
    public constant integer BLACK_MARBLE = 'Xblm'
    public constant integer BRICK_TILES = 'Xbtl'
    public constant integer SQUARE_TILES = 'Xsqd'
    public constant integer ROUND_TILES = 'Xrtl'
    public constant integer GRASS = 'Xgsb'
    public constant integer TRIM_GRASS = 'Xhdg'
    public constant integer WHITE_MARBLE = 'Xwmb'
    public constant integer DIRT_CLIFF = 'cXc2'
    public constant integer SQUARE_TILES_CLIFF = 'cXc1'
endglobals

endscope

scope DUNGEON
// Dungeon
globals
    public constant integer DIRT = 'Ddrt'
    public constant integer BRICK = 'Dbrk'
    public constant integer RED_STONES = 'Drds'
    public constant integer LAVA_CRACKS = 'Dlvc'
    public constant integer LAVA = 'Dlav'
    public constant integer DARK_ROCKS = 'Ddkr'
    public constant integer GREY_STONES = 'Dgrs'
    public constant integer SQUARE_TILES = 'Dsqd'
    public constant integer DIRT_CLIFF = 'cDc2'
    public constant integer SQUARE_TILES_CLIFF = 'cDc1'
endglobals

endscope

scope UNDERGROUND
// Underground
globals
    public constant integer DIRT = 'Gdrt'
    public constant integer BRICK = 'Gbrk'
    public constant integer RED_STONES = 'Grds'
    public constant integer LAVA_CRACKS = 'Glvc'
    public constant integer LAVA = 'Glav'
    public constant integer DARK_ROCKS = 'Gdkr'
    public constant integer GREY_STONES = 'Ggrs'
    public constant integer SQUARE_TILES = 'Gsqd'
    public constant integer DIRT_CLIFF = 'cGc2'
    public constant integer SQUARE_TILES_CLIFF = 'cGc1'
endglobals

endscope

scope SUNKENRUINS
// Sunken Ruins
globals
    public constant integer DIRT = 'Zdrt'
    public constant integer ROUGH_DIRT = 'Zdtr'
    public constant integer GRASSY_DIRT = 'Zdrg'
    public constant integer SMALL_BRICKS = 'Zbks'
    public constant integer SAND = 'Zsan'
    public constant integer LARGE_BRICKS = 'Zbkl'
    public constant integer ROUND_TILES = 'Ztil'
    public constant integer GRASS = 'Zgrs'
    public constant integer DARK_GRASS = 'Zvin'
    public constant integer DIRT_CLIFF = 'cZc2'
    public constant integer LARGE_BRICKS_CLIFF = 'cZc1'
endglobals

endscope

scope ICECROWNGLACIER
// Icecrown Glacier
globals
    public constant integer DIRT = 'Idrt'
    public constant integer ROUGH_DIRT = 'Idtr'
    public constant integer DARK_ICE = 'Idki'
    public constant integer BLACK_BRICKS = 'Ibkb'
    public constant integer RUNE_BRICKS = 'Irbk'
    public constant integer TILED_BRICKS = 'Itbk'
    public constant integer ICE = 'Iice'
    public constant integer BLACK_SQUARES = 'Ibsq'
    public constant integer SNOW = 'Isnw'
    public constant integer RUNE_BRICKS_CLIFF = 'cIc2'
    public constant integer SNOW_CLIFF = 'cIc1'
endglobals

endscope

scope OUTLAND
// Outland
globals
    public constant integer DIRT = 'Odrt'
    public constant integer LIGHT_DIRT = 'Odtr'
    public constant integer ROUGH_DIRT = 'Osmb'
    public constant integer CRACKED_DIRT = 'Ofst'
    public constant integer FLAT_STONES = 'Olgb'
    public constant integer ROCK = 'Orok'
    public constant integer LIGHT_FLAT_STONES = 'Ofsl'
    public constant integer ABYSS = 'Oaby'
    public constant integer ABYSS_CLIFF = 'cOc1'
    public constant integer ROUGH_DIRT_CLIFF = 'cOc2'
endglobals

endscope

scope BLACKCITADEL
// Black Citadel
globals
    public constant integer DIRT = 'Kdrt'
    public constant integer LIGHT_DIRT = 'Kfsl'
    public constant integer ROUGH_DIRT = 'Kdtr'
    public constant integer FLAT_STONES = 'Kfst'
    public constant integer SMALL_BRICKS = 'Ksmb'
    public constant integer LARGE_BRICKS = 'Klgb'
    public constant integer SQUARE_TILES = 'Ksqt'
    public constant integer DARK_TILES = 'Kdkt'
    public constant integer DIRT_CLIFF = 'cKc1'
    public constant integer DARK_TILES_CLIFF = 'cKc2'
endglobals

endscope

scope DALARANRUINS
// Dalaran Ruins
globals
    public constant integer DIRT = 'Jdrt'
    public constant integer ROUGH_DIRT = 'Jdtr'
    public constant integer BLACK_MARBLE =  'Jblm'
    public constant integer BRICK_TILES = 'Jbtl'
    public constant integer SQUARE_TILES = 'Jsqd'
    public constant integer ROUND_TILES = 'Jrtl'
    public constant integer GRASS = 'Jgsb'
    public constant integer TRIM_GRASS = 'Jhdg'
    public constant integer WHITE_MARBLE = 'Jwmb'
    public constant integer DIRT_CLIFF = 'cJc2'
    public constant integer SQUARE_TILES_CLIFF = 'cJc1'
endglobals

endscope

endlibrary

Nice!
That's incredible. Thanks for that :p

I'll put those into the map, and add an explanation on how to use them.

Edit: I removed the Library, so it's just TILESET_TILE instead of TTS_TILESET_TILE
Edit 2: I also changed the header to:
JASS:
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-= Terrain Type Constants by Darthfett =-=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-= Thanks to Romek for the Raw Codes  -=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

Romek

Super Moderator
Reaction score
963
Very good, especially for minigames and the like.

Thanks, I actually started (And won't finish) a Minimap sort of game which used this system. In the world editor, I was placing Dalaran marble and stuff with trees on it. :p
In-Game however, it became a lush, green forest ;)

I think that using every possible tile in-game is one of the best uses of this.
(Along with weather systems)
 

Romek

Super Moderator
Reaction score
963
Updated.
  • Remade nearly the entire code
  • Fixed quite a major bug involving rects. (Only worked with X and Y's in multiples of 2048)
  • The code is now shorter than the Comments (This could be a snippet again :p)

Also, I haven't tested version 3 ith 480*480 maps yet.
If you find any problems, please tell me :p
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Just wanna ask some questions because I want to input this in my map and replace my current terrain changer. It changes terrain instantly, right? For a 96x96 map, would it lag for a brief moment, say less than 0.1 second? Or more? Or not at all?
 

Romek

Super Moderator
Reaction score
963
Just wanna ask some questions because I want to input this in my map and replace my current terrain changer. It changes terrain instantly, right? For a 96x96 map, would it lag for a brief moment, say less than 0.1 second? Or more? Or not at all?

It lags for about a second on a 256x256 map.
So, yes, it would be about 0.1 seconds on a 96x96 map.

This depends on your computer too.

And, I suggest replace terrain at map init unless you need to do it in-game (Weather, etc)
 

Kazuga

Let the game begin...
Reaction score
110
You should add that newgen is needed to use this. Received a lot of errors when testing it in my map. Nice snippet though. Could be very useful indeed.
 

Romek

Super Moderator
Reaction score
963
You should add that newgen is needed to use this. Received a lot of errors when testing it in my map. Nice snippet though. Could be very useful indeed.

Ok. I thought I had it.. Must've gotten rid of it at some point :p
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
You can't have more 16 terrain type in a map in any way, it's harcoded in war3.
It will fail even if you try it with your function, instead of the new terrain type it will be a one which had already be used.
 

Romek

Super Moderator
Reaction score
963
You can't have more 16 terrain type in a map in any way, it's harcoded in war3.
It will fail even if you try it with your function, instead of the new terrain type it will be a one which had already be used.
You can change them when needed though.
So if all players enter some dungeon or something, change the terrain type in there. Then change it back to dirt and stuff.

Does anyone know if changing terrain types desyncs if used with GetLocalPlayer()?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top