Replacing terrains
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 terrains
I need to change all terrains on map from one type of another. According to documentation, this should do it:
[event]
name=start
[terrain]
terrain=Chr
[or]
terrain=Ch
[/or]
[/terrain]
[/event]
But it doesn't. Tried other approaches - nothing. Why is it not working and what should I use insted?
[event]
name=start
[terrain]
terrain=Chr
[or]
terrain=Ch
[/or]
[/terrain]
[/event]
But it doesn't. Tried other approaches - nothing. Why is it not working and what should I use insted?
Re: Replacing terrains
If the wiki is correct and [terrain] does indeed take a SLF, then it's currently in a rather broken/ambiguous state because terrain= is supposed to be a valid key both for [terrain] itself and a SLF.
Re: Replacing terrains
Yes, zookeper, it seems same way for me.
It seems that wiki is wrong, and [terrain] doesn't understand anything from SLF. And analysing sources shows the same. Just x and y, or range of x and y, but that's all.
Btw, I found a working solution:
As you see, only when I get rid of everyrhing SLF in [terrain] it worked...
It seems that wiki is wrong, and [terrain] doesn't understand anything from SLF. And analysing sources shows the same. Just x and y, or range of x and y, but that's all.
Btw, I found a working solution:
Code: Select all
[store_locations]
terrain=C*
variable=temp_castles
[/store_locations]
{FOREACH temp_castles i}
[terrain]
x=$temp_castles[$i].x
y=$temp_castles[$i].y
terrain=Chr
[/terrain]
{NEXT i}
Re: Replacing terrains
Btw, I'm using this macro that works about as [terrain] should:
Usage:
Code: Select all
#define TERRAIN RULES TO
[store_locations]
{RULES}
variable=TERRAIN_TEMP
[/store_locations]
{FOREACH TERRAIN_TEMP TERRAIN_TEMP_i}
[terrain]
x=$TERRAIN_TEMP[$TERRAIN_TEMP_i].x
y=$TERRAIN_TEMP[$TERRAIN_TEMP_i].y
terrain={TO}
[/terrain]
{NEXT TERRAIN_TEMP_i}
#enddef
Code: Select all
{TERRAIN terrain=C* Chr}
{TERRAIN (
x=40
y=40
radius=10
) Qxu}