Replacing specific terrain
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Replacing specific terrain
Hello, I'm an amateur WML coder, and I'm wondering if there's a way to change a map's terrain by filtering the terrain type instead of its location. For example, let's say I'm making a scenario where I want every water hex to be replaced with an ice hex.
This was my attempt, but it didn't work. I'd appreciate it if someone could tell me if this is possible and give me a sample code if it is. Thanks!
Code: Select all
[event]
name= turn 3
[terrain]
[filter]
[filter_location]
terrain=Wwg
[/filter_location]
[/filter]
terrain=Ai
[/terrain]
[/event]
Re: Replacing specific terrain
Code: Select all
[event]
name= turn 3
[terrain]
[and]
terrain=Wwg
[/and]
terrain=Ai
[/terrain]
[/event]
Re: Replacing specific terrain
Zookeeper: That always seems like strange syntax.
Why is this preferable to the old=/new= like the [terrain_mask]?
Why is this preferable to the old=/new= like the [terrain_mask]?
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Replacing specific terrain
It wouldn't make sense. Apples and oranges.UnwiseOwl wrote:Zookeeper: That always seems like strange syntax.
Why is this preferable to the old=/new= like the [terrain_mask]?
Re: Replacing specific terrain
To me
[terrain]
[and]... is complete gibberish.
But I guess this is why you're the coder and I'm not
[terrain]
[and]... is complete gibberish.
But I guess this is why you're the coder and I'm not
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Replacing specific terrain
i agree that this syntax is rather strange, if we would implement [terrain] now it'd probably have a [filter_location] tag or a new_terrain= attribtue, and work similar to how michaelan though it would. The reason why is has the current syntax is that [terrain] used to only have terrain=,x=,y= attributes and no location filter support and then the x=,y= syntax was exteded with complate location filter support so the terrain= attribute clashed with the terrain= attribute in location filters.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: Replacing specific terrain
Thanks so much for the help, Zookeeper. It worked perfectly.
The syntax for this specific code is rather unintuitive. Will this potentially be changed in the future?
The syntax for this specific code is rather unintuitive. Will this potentially be changed in the future?
Re: Replacing specific terrain
what if i want to store a location variable so that the terrain changes at a later point. like, lets say that i have a map with both ice and water terrain. then, i change all the water to become ice, with zookeeper's code. later, i want all the ice terrain that used to be water to go back to being water, with the original ice terrain staying the same. how do i store the original water terrain into a variable so that i can change it back later?
Re: Replacing specific terrain
Then what you want to do is to store all the water locations for example in a prestart event like this:Fabluiso wrote:what if i want to store a location variable so that the terrain changes at a later point. like, lets say that i have a map with both ice and water terrain. then, i change all the water to become ice, with zookeeper's code. later, i want all the ice terrain that used to be water to go back to being water, with the original ice terrain staying the same. how do i store the original water terrain into a variable so that i can change it back later?
Code: Select all
[store_locations]
terrain=Wwg
variable=water_locs
[/store_locations]
Code: Select all
[terrain]
find_in=water_locs
terrain=Ai
[/terrain]