• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Raising Terrain?

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2010
Messages
2,275
First of all, hey whats up long time no see. Now for my question:

I got back 2 days ago and started working on my map this morning, ive seen in many games where people increased or decreased the terrains height in a certain spot, i cannot find how to do this... anyone know?
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
okay then...
  • Sorceress death
    • Events
      • Unit - Sorceress 0025 <gen> Dies
    • Conditions
    • Actions
      • Environment - Change terrain type at (Center of Region 062 <gen>) to Lordaeron Summer - Grass using variation -2 in an area of size 5 and shape Square
      • Environment - Change terrain type at (Center of Region 063 <gen>) to Lordaeron Summer - Grass using variation 1 in an area of size 2 and shape Square
There now it belongs here, it wont lower or raise terrain.
 
the terrain in wc3 is grid-based (as in most other games) so you can change the terrain at every grid node to raise the whole terrain around it

JASS:
function RaiseTerrain takes real x, real y, real x2, real y2, real height returns nothing
    local real y0 = y
    local real r = 32.00

    loop
        exitwhen x > x2

        set y = y0
        loop
            exitwhen y > y2
            call TerrainDeformCrater(x, y, r, -height, 1, true)
            set y = y + r
        endloop

        set x = x + r
    endloop
endfunction
note that you might hit the operation limit for very big regions
(there are workarounds for it)

this code will change the terrain level like this:
Code:
      x2/y2
  +----+
  |    |
  |    |
  |    |
  +----+
x/y
 

Attachments

  • terraforming.jpg
    terraforming.jpg
    123.2 KB · Views: 101
  • terraforming.w3x
    12.4 KB · Views: 51
Level 17
Joined
Jun 17, 2010
Messages
2,275
the terrain in wc3 is grid-based (as in most other games) so you can change the terrain at every grid node to raise the whole terrain around it

JASS:
function RaiseTerrain takes real x, real y, real x2, real y2, real height returns nothing
    local real y0 = y
    local real r = 32.00

    loop
        exitwhen x > x2

        set y = y0
        loop
            exitwhen y > y2
            call TerrainDeformCrater(x, y, r, -height, 1, true)
            set y = y + r
        endloop

        set x = x + r
    endloop
endfunction
note that you might hit the operation limit for very big regions
(there are workarounds for it)

this code will change the terrain level like this:
Code:
      x2/y2
  +----+
  |    |
  |    |
  |    |
  +----+
x/y

Im only making a 3x3 square and a 1x3 rectangle go up and down, is there a way i could instead of using a full jass function, make it into a custom script? If not could i have just this 1 jass statement in my triggers and the rest GUI?
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
I think you can paste it in the map custom script (In triggers editor,click on the map name and paste the jass code there). Then you can call D4rk_G4ND4LF's function whenever you want in a GUI trigger by creating Custom Script action and typing 'call RaiseTerrain(x,y,x2,y2,height)'. And of course typing parameters to your choice. Since GUI uses locations,you can get their X-s and Y-s by using GetLocationX/Y(Location name).
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
It can be associated with a region.
  • Set Region = Your Region
  • Set Height = How much you want to raise terrain
  • Custom script: call RaiseTerrain(GetRectMinX(udg_Region),GetRectMinY(udg_Region),GetRectMaxX(udg_Region),GetRectMaxY(udg_Region),udg_Height)
You just need to set Region and Height,no need to change custom script.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Kk all done now im going to test it and tell you what happens.

Error: Expected a Name for
  • Custom script: call RaiseTerrain(GetRectMinX(udg_Terrain_Dec_Region),GetRectMinY(udg_Terrain_Dec_Region),GetRectMaxX(udg_Terrain_Dec_Region),GetRectMaxY(udg_Terrain_Dec_Region),udg_Dec_Integer)
 
Last edited:
Level 20
Joined
Jul 6, 2009
Messages
1,885
Have you done everything as in my test map?
Check following things:
- Did you copy whole D4RK G4ND4LF's function in map custom script.
- Do names of variables match the ones in brackets when calling RaiseTerrain function.
- Is height variable real.

And don't double post :p
 
you don't have to use the JASS function if you don't want to (though it is easier and faster)
there is a GUI function to do the same with locations
just set all locations to values which are multiple of 32 to change the height of the grid nodes

if you want to do something with destructables instead you can use a line of custom script to place them at different heights
http://wiki.thehelper.net/wc3/jass/common.j/CreateDestructableZ
e.g. you could make a model (or find it somewhere) with terrain texture and change the height of it so it fits your needs

I don't understand why you are making such a big thing out of this; i did this in a map once, i think all i had to do was insert a negative value in the "create terrain deformation" action. I can check the map if you can't get it to work.

which is exactly the same as what I posted already
 
Status
Not open for further replies.
Top