• 🏆 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!

Terrain - Change terrain type using For each (Integer A)

Status
Not open for further replies.
Level 2
Joined
Nov 10, 2019
Messages
14
Must be in GUI, possibly with custom scripts.
if impossible to do so, JASS can be used instead with a greater explanation, since I've never used JASS.
I've been looking around the hws, and I'm a bit confused?

I've been working on a TD, where you vote for the track to be used.
The voted track will therefore be set and the rest of the terrain should be changed.

In the start, while you're voting I have 3 tracks that are being shown how the units would run if it were the one that was chosen.
Now as the track has been chosen the space of the other tracks will be used for something else, therefore they should be changed & regions removed.

Below I've set the precreated regions from terrain editor to each their index value, in a global region variable "RegionsRemove[]"

  • setting region indexes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RegionsRemove[0] = 01 <gen>
      • Set RegionsRemove[1] = 010 <gen>
      • Set RegionsRemove[2] = 011 <gen>
      • Set RegionsRemove[3] = 012 <gen>
How do I change the terrain type in those regions, for the whole region?

  • timer expires
    • Events
      • Time - terraintimer expires
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 3, do (Actions)
        • Loop - Actions
          • Environment - Change terrain type at (Center of RegionsRemove[(Integer A)]) to Lordaeron Summer - Grass using variation -1 in an area of size 1 and shape Square
Whereas this of course only covers the center tile of the region.

I've figured I might have to do some set locations X and Y, but I'm not really sure about it.

When the timer expires it should:
• Change the terrain type for all the regions.
• destroy the regions - as they won't be used anymore
• possibly take care of leaks (if it does leak)??

---- Conditions of the voted track has been left out, as that is not the problem. ----

Help would be appreciated ;)
 
Last edited:
Level 9
Joined
Sep 20, 2015
Messages
385
Regions are made by a series of points, what you can do it change every point in the region. But i suggest to use a trigger that cheges the terrain type in a loop, until the all lane is of one specific terrain type.

So

You create a variable, Tpoint.

A trigger that changes the terrain type.

  • Environment - SetTerrainType to TerrainTypechoosed at Tpoint
Then you change the point to another location.
 
Level 2
Joined
Nov 10, 2019
Messages
14
Could you make an example?
This doesn't provide much help as I am lost lol.
I've tried looking into various JASS codes for help, since it seemed like the easier way to go.
But none of which I could make work...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Use loop A with a nested Loop B inside it.

A controls row number, while B controls column. B is restarted for each row. Start from the lower left corner of the region and add to that. Each tile edge is 128 units of distance and so one would multiply A and B by 128 when calculating the offset. If using GUI you must destroy the points made within the B loop as you are making one every B loop.
 
Status
Not open for further replies.
Top