An event that can auto modify terrain but end with question
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.
-
- Posts: 25
- Joined: February 29th, 2012, 2:04 pm
- Location: Taiwan
An event that can auto modify terrain but end with question
Hi all,
I'm a newbie for WML.
Recently, I'm working on an event that can modify terrain every new turn. That is, I want my unit to plant some tree on the map, but don't want it finished in a turn. I want it to have "growth" procedure.
Therefore I search for likely WML and change its detail. Please see below:
Well...event does works, but only when there is unit standing on the terrain(no matter from which side or what unit).
I wish it could growth automatically. I've been trying many other WML(like have _location, set_variable) to fix it but still in vain. Does anyone who can point out where is the problem?
Thanks a lot.
I'm a newbie for WML.
Recently, I'm working on an event that can modify terrain every new turn. That is, I want my unit to plant some tree on the map, but don't want it finished in a turn. I want it to have "growth" procedure.
Therefore I search for likely WML and change its detail. Please see below:
Code: Select all
[event]
name=new turn
first_time_only=no
[store_locations]
[filter]
[filter_location]
terrain=*^Zt0 #this is seed terrain I made myself
[/filter_location]
[/filter]
variable=0tree
[/store_locations]
[store_locations]
[filter]
[filter_location]
terrain=*^Zta #this is small tree terrain I made myself
[/filter_location]
[/filter]
variable=atree
[/store_locations]
[store_locations]
[filter]
[filter_location]
terrain=*^Ztb #this is medium tree terrain I made myself
[/filter_location]
[/filter]
variable=btree
[/store_locations]
[set_variable]
name=sound
value=no
[/set_variable]
#----------------------------------
{FOREACH 0tree rh}
[set_variable]
name=temp_x
value=$0tree[$rh].x
[/set_variable]
[set_variable]
name=temp_y
value=$0tree[$rh].y
[/set_variable]
[set_variable]
name=sound
value=yes
[/set_variable]
{MODIFY_TERRAIN "Gs^Zta" $temp_x $temp_y}
{NEXT rh}
[if]
[variable]
name=sound
equals=yes
[/variable]
[then]
[sound]
name=entangle.wav
[/sound]
[delay]
time=200
[/delay]
[/then]
[/if]
#------------------------------
{FOREACH atree rh}
[set_variable]
name=temp_x
value=$atree[$rh].x
[/set_variable]
[set_variable]
name=temp_y
value=$atree[$rh].y
[/set_variable]
[set_variable]
name=sound
value=yes
[/set_variable]
{MODIFY_TERRAIN "Gs^Ztb" $temp_x $temp_y}
{NEXT rh}
[if]
[variable]
name=sound
equals=yes
[/variable]
[then]
[sound]
name=entangle.wav
[/sound]
[delay]
time=200
[/delay]
[/then]
[/if]
#-----------------------------------------
{FOREACH btree rh}
[set_variable]
name=temp_x
value=$btree[$rh].x
[/set_variable]
[set_variable]
name=temp_y
value=$btree[$rh].y
[/set_variable]
[set_variable]
name=sound
value=yes
[/set_variable]
{MODIFY_TERRAIN "Gs^Fp" $temp_x $temp_y}
{NEXT rh}
[if]
[variable]
name=sound
equals=yes
[/variable]
[then]
[sound]
name=entangle.wav
[/sound]
[delay]
time=200
[/delay]
[/then]
[/if]
[clear_variable]
name=sound,0tree,atree,btree
[/clear_variable]
[redraw]
[/redraw]
[/event]
I wish it could growth automatically. I've been trying many other WML(like have _location, set_variable) to fix it but still in vain. Does anyone who can point out where is the problem?
Thanks a lot.
Re: An event that can auto modify terrain but end with quest
[filter] filters units. Remove that part from around filtering locations.
-
- Posts: 25
- Joined: February 29th, 2012, 2:04 pm
- Location: Taiwan
Re: An event that can auto modify terrain but end with quest
Hi Ravana,
I've tried this before, but it end up with all map change into tree terrain at the very beginning, even my own castle. Should I make any modification with this change? Thanks for your advice.
I've tried this before, but it end up with all map change into tree terrain at the very beginning, even my own castle. Should I make any modification with this change? Thanks for your advice.
-
- Posts: 25
- Joined: February 29th, 2012, 2:04 pm
- Location: Taiwan
Re: An event that can auto modify terrain but end with quest
Oops, I misunderstanding what you mean. After I remove whole [filter] and [filter_locations], event works fine!!! Thank you so much!!!
-
- Posts: 3
- Joined: December 17th, 2017, 6:33 am
Re: An event that can auto modify terrain but end with quest
Hey, after I saw this thread earlier today, I started trying to add a similar effect to explosive (AoE) attacks from Dugi's LotI for my own use. This has given me the best results so far:
Problem is, it changes all walls on the entire map, and I can't for the life of me figure out how to reign it in without restricting it to one hex only, which defeats the purpose of this effort. My thought was that an attack this powerful SHOULD have some sort of effect on the terrain as well, like breaking down walls near the impact site.
I'm kind of a noob at coding, so any help/advice is greatly appreciated!
Edit: ...and yes, I'm aware this can make these moves OP, breaks balance/scenario flow/etc.
Like I said, this is only for my own use, and I LIKE having a couple of OP godlings under my control! *awkward slide*
Code: Select all
[if]
[variable]
name=damage
greater_than=108 # If the damage is higher than most common attacks can get, the range is increased even even more.
[/variable]
[then]
[harm_unit_loti]
[filter]
[filter_location]
# Exclude the units that just received the damage.
[not]
x,y=$x2,$y2
radius=3
[/not]
# Include the remaining units within two hexes.
[and]
x,y=$x2,$y2
radius=5
[/and]
[/filter_location]
[filter_side]
[enemy_of]
side=$unit.side
[/enemy_of]
[/filter_side]
[/filter]
[filter_second]
x,y=$x1,$y1
[/filter_second]
amount=$($($damage)/3-16)
damage_type=$weapon.type
fire_event=yes
animate=no
poisoned=$has_poison
[/harm_unit_loti]
#My changes start here
[store_locations]
[filter_location]
x,y=$x2,$y2
radius=3
[/filter_location]
variable=wall
[/store_locations]
{FOREACH wall rh}
[set_variable]
name=temp_x
value=$wall[$rh].x
[/set_variable]
[set_variable]
name=temp_y
value=$wall[$rh].y
[/set_variable]
[terrain]
[and]
terrain=X*,X*^*,*^X* # here is the filter criterion
[/and]
terrain=Zvw^Dr # and the new terrain
[/terrain]
{NEXT rh}
[redraw]
[/redraw]
[/then]
[/if]
{CLEAR_VARIABLE damage,has_poison}
[/event]
I'm kind of a noob at coding, so any help/advice is greatly appreciated!
Edit: ...and yes, I'm aware this can make these moves OP, breaks balance/scenario flow/etc.
Like I said, this is only for my own use, and I LIKE having a couple of OP godlings under my control! *awkward slide*
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: An event that can auto modify terrain but end with quest
That's because you didn't put any x and y values in the [terrain] tag. If I understand what you're trying to do, you need to putGreenwiz34 wrote:Problem is, it changes all walls on the entire map
x=temp_x
and y=temp_y
in there.Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
-
- Posts: 3
- Joined: December 17th, 2017, 6:33 am
Re: An event that can auto modify terrain but end with quest
So, I tried what you suggested, but it limited the effect to the targeted hex only, no AoE.
I'm thinking my store_location block isn't doing what I want, but I don't know enough about WML to have any clue how to fix it...
I'm thinking my store_location block isn't doing what I want, but I don't know enough about WML to have any clue how to fix it...
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: An event that can auto modify terrain but end with quest
Oh, right. [filter_location] is part of the standard unit filter, not part of the standard location filter. You need to take it out.Greenwiz34 wrote:I'm thinking my store_location block isn't doing what I want
Code: Select all
[store_locations]
x,y=$x2,$y2
radius=3
variable=wall
[/store_locations]
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
-
- Posts: 3
- Joined: December 17th, 2017, 6:33 am
Re: An event that can auto modify terrain but end with quest
Hey, I finally got it working how I wanted!
Here's what I ended up with:
It knocks down walls within a few hexes of the impact site, but leaves the rest of the map alone, just as I envisioned it.
Thanks for the tips! I don't think I could have managed this without the help.
Here's what I ended up with:
Code: Select all
[store_locations]
terrain=X*,X*^*,*^X* # here is the filter criterion
[and]
x,y=$x2,$y2
radius=3
[/and]
variable=wall
[/store_locations]
{FOREACH wall rh}
[set_variable]
name=temp_x
value=$wall[$rh].x
[/set_variable]
[set_variable]
name=temp_y
value=$wall[$rh].y
[/set_variable]
{MODIFY_TERRAIN "Zvw^Dr" $temp_x $temp_y}
{NEXT rh}
[redraw]
[/redraw]
Thanks for the tips! I don't think I could have managed this without the help.