Changing 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.
Changing terrain
I can`t figure out why this event doesn`t work. It sets the item properly, all the menu work, it takes the gold as it should. But the terrain doesn`t change, i can`t figure out why. This is on dev version 1.7
Code: Select all
[event]
name=turn 1
first_time_only=yes
[set_menu_item]
id=Build
description="Building"
[show_if]
[have_unit]
side=$side_number
x,y=$x1,$y1
type="Peasant"
[filter_location]
terrain="Khr,Gg"
[/filter_location]
[/have_unit]
[/show_if]
[command]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
kill=yes
mode=replace
variable=worker
[/store_unit]
[if]
[variable]
name=worker.moves
greater_than=0
[/variable]
[then]
[message]
speaker="narrator"
message= _ "`@Do you want to build the Castle?"
[option]
message= _ "Build a Castle. -20 Gold"
[command]
[if]
[variable]
name=gold
greater_than_equal_to=20
[/variable]
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
[gold]
side=$side_number
amount=-20
[/gold]
[terrain]
x=$x1
y=$y1
letter="Kh"
replace_if_failed=yes
[/terrain]
[/then]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
[option]
message= _ "Don't Build"
[command]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
[/message]
[/then]
[else]
[unstore_unit]
variable=worker
[/unstore_unit]
[/else]
[/if]
[/command]
[/set_menu_item]
[/event]
Re: Changing terrain
Of course you can, you've already pinpointed the exact point where the mistake is as far as I can tell. That is, you're using letter= and not terrain=.Fosprey wrote:But the terrain doesn`t change, i can`t figure out why.
Re: Changing terrain
Thanks for the answer, but as far as i can tell you can use letter instead of terrain, I saw it multiple times in all the building eras i revised. Anyway i tried to change it, but still the same problemzookeeper wrote:Of course you can, you've already pinpointed the exact point where the mistake is as far as I can tell. That is, you're using letter= and not terrain=.Fosprey wrote:But the terrain doesn`t change, i can`t figure out why.
Code: Select all
[event]
name=turn 1
first_time_only=yes
[set_menu_item]
id=Build
description="Building"
[show_if]
[have_unit]
side=$side_number
x,y=$x1,$y1
type="Peasant"
[filter_location]
terrain="Khr,Gg"
[/filter_location]
[/have_unit]
[/show_if]
[command]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
kill=yes
mode=replace
variable=worker
[/store_unit]
[if]
[variable]
name=worker.moves
greater_than=0
[/variable]
[then]
[message]
speaker="narrator"
message= _ "`@Do you want to build the Castle?"
[option]
message= _ "Build a Castle. -20 Gold"
[command]
[if]
[variable]
name=gold
greater_than_equal_to=20
[/variable]
[then]
[set_variable]
name=worker.moves
value=0
[/set_variable]
[gold]
side=$side_number
amount=-20
[/gold]
[terrain]
x=$x1
y=$y1
terrain="Kh"
replace_if_failed=yes
[/terrain]
[/then]
[/if]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
[option]
message= _ "Don't Build"
[command]
[unstore_unit]
variable=worker
[/unstore_unit]
[/command]
[/option]
[/message]
[/then]
[else]
[unstore_unit]
variable=worker
[/unstore_unit]
[/else]
[/if]
[/command]
[/set_menu_item]
[/event]