• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

saving a region's terrain

Status
Not open for further replies.
Level 3
Joined
Jun 9, 2019
Messages
27
i am making a spell which the terrain under caster within a aoe wukk change but and it will back to normall after some time but when i test it i saw all of the changed terrain will change back to the terrain under the caster for example we have a area which have grass rock and dirt will change all of theme to snow and after spell finished all of theme change to grass not to the thing they ware.any 1 can help ?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I attached a map with an example of what you could do.

How it works: I store points around the Caster in a 5x5 area. Each terrain tile is 128x128 units so by knowing this we can calculate a 5x5 area of terrain easily. In my trigger I map out points starting at the top left corner of our area. I end up storing 25 points (5x5) and I store the terrain at those points too. Once I've stored everything I then set the terrain at these points to snow and then after 5 seconds I return the terrain tiles back to their original type.

You'll notice that instead of a 5 second timer, I use a dummy unit that casts an ability based off of Channel. The ability has a 5 second follow through time which I triggered so that when it stops casting the ability (because it has finished channeling) we set the Terrain back to normal. It's not the most efficient solution, but well, I was feeling lazy and it works just fine.

Note that the trigger will ignore terrain that is already Snow. This is because there was a problem in which the snow would end up becoming set as the "original" terrain-type (happened if we overlapped casts) and would end up staying there permanently. So by making it ignore the Snow it fixed this issue. However, now you'll notice some weird interactions if you spam the ability around the same area, like patches of snow instead of full 5x5 squares. It's not a big deal and you'll only notice it if you're spamming the ability like crazy.

Edit: Re-uploaded map
Edit 2: Updated map. Added a Terrain Variation variable to track the different variation types of each terrain tile.
 

Attachments

  • Snow.w3x
    19.8 KB · Views: 15
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
The basic idea is that you want to store all the existing terrain details for tiles which will be changed in a list. This includes both the tile type and tile variation of the terrain. After the ability ends one can use the same tile selection logic to apply the terrain details from the list to restore the terrain.

To support overlapped casts the system becomes a lot more complicated and I would not recommend attempting it without using JASS or more recommended Lua.
 
Status
Not open for further replies.
Top