• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

change terrain tiles of the whole map

Status
Not open for further replies.
Level 7
Joined
Oct 12, 2020
Messages
81
i want to make that all tiles on the map turn to snow as soon as map starts does anybody got triggers for it?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
if it's as soon as it starts, why not change the tileset in the editor?
Allows some variation. Especially if you do not lock in all 16 tile types. You could have the map significantly different between playthroughs based on RNG.
i want to make that all tiles on the map turn to snow as soon as map starts does anybody got triggers for it?
Depending on map size this might not be possible with a single thread and might take significant resources to the point it causes performance issues (waiting for player) when it executes. Consider iterating the map staggered over a period of time.
 
Level 19
Joined
Feb 27, 2019
Messages
582
I dont know who to credit for this but I use it in my map. If you know who to credit please tell me so that I can add it to my credits.
JASS:
/*--------------------
 RT2
----------------------*/ 
function RT2 takes real X, real Y, integer T returns nothing
        call SetTerrainType(X, Y, T, -1, 1, 1)
    endfunction
/*--------------------
 RT1
----------------------*/     
    function RT1 takes real MinX, real MaxX, real Y, integer OldTerrain, integer Terrain returns nothing
        loop
            exitwhen MinX > MaxX
                if GetTerrainType(MinX, Y) == OldTerrain then
                    call RT2 (MinX, Y, Terrain)
                endif
            set MinX = MinX + 128
        endloop
    endfunction
/*--------------------
 Replace Terrain Type Ex
----------------------*/        
    function ReplaceTerrainTypeEx takes integer OldTerrain, integer NewTerrain, rect WhichRect returns nothing
        local real MinX = GetRectMinX(WhichRect)
        local real MaxX = GetRectMaxX(WhichRect)
        local real MinY = GetRectMinY(WhichRect)
        local real MaxY = GetRectMaxY(WhichRect)       
        loop
            exitwhen MinY > MaxY
                call RT1 (MinX, MaxX, MinY, OldTerrain, NewTerrain)
            set MinY = MinY + 128
        endloop
    endfunction
/*--------------------
 ReplaceGlobalTerrain
----------------------*/ 
    function ReplaceGlobalTerrain takes integer OldTerrain, integer NewTerrain returns nothing
        call ReplaceTerrainTypeEx(OldTerrain, NewTerrain, GetWorldBounds())
    endfunction
/*--------------------
 ReplaceGlobalTerrainReversed
----------------------*/     
    function ReplaceGlobalTerrainReversed takes integer NewTerrain, integer OldTerrain returns nothing
        call ReplaceTerrainTypeEx(OldTerrain, NewTerrain, GetWorldBounds())
    endfunction
  • Custom script: call ReplaceGlobalTerrain ('Lgrd', 'Wgrs')
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-= 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' = Barrens – Pebbles
'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 -
 
Level 19
Joined
Feb 27, 2019
Messages
582
I did modify tilesets on my map at a point to add all tilesets I would use but when I look now in WE it only shows the standard tileset, so unless my map is bugged, it should be possible to replace any tileset via triggers, because I tested it and it still works. One reason to modify the tilesets is to choose priority of the terrain since it will display differently on the map, but who knows, it might be possible anyway if thats the case.

I do not change doodads, I dont think there is an option to reference doodads. There is an option to reference destructibles though, and they can work basically the same way from what I know.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Once a terrain texture is loaded it cannot be unloaded. At most 16 terrain textures can be loaded. Triggers cannot bypass these limitations. A texture is loaded if it is used in the map's tileset or the first time a trigger places it in the world. Trying to place new terrain texture using triggers after hitting the 16 terrain texture limit will result in the tiles being assigned one of the already existing 16 terrain textures, not the one desired.
 
Status
Not open for further replies.
Top