Working useful macros!
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.
Working useful macros!
EDIT------------
From now on i will use this thread for all my coding questions.
I will post the working codes below for others to enjoy!
HOW TO:
From now on i will use this thread for all my coding questions.
I will post the working codes below for others to enjoy!
HOW TO:
Teleport from terrain X1 to X2 (both ways)
Make peasant dig through caves (at the cost of moves)
Make one enemy for each chosen terrain (good in scenarios)
My Transport Galleon macro (fully functional)!
Last edited by Flyro on April 15th, 2011, 6:06 am, edited 14 times in total.
Flyro
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987
-
- Posts: 1549
- Joined: June 18th, 2009, 1:45 am
Re: Why dont this work?
because terrain= is a key available only under the Standard Location Filter. x,y= works in both.
Here's links to both indexes of filters: StandardUnitFilter StandardLocationFilter
Here's links to both indexes of filters: StandardUnitFilter StandardLocationFilter
Re: Why dont this work?
Try this instead
Code: Select all
#define TELE_TERRAIN_ON
[event]
name=moveto
first_time_only=no
[if]
[have_location]
terrain=Rrc
[filter]
side=$side_number
[/filter]
[/have_location]
[then]
[store_locations]
variable=telea
[filter]
[filter_location]
terrain=Rrc
[/filter_location]
[not]
x,y=$x1,$y1
[/not]
[/filter]
[/store_locations]
[teleport]
[filter]
x,y=$x1,$y1
[/filter]
x=$telea.x
y=$telea.y
[/teleport]
[redraw]
[/redraw]
[/then]
[/if]
[/event]
#enddef
Re: Why dont this work?
Nope that doesn't work neitherKapoue_II wrote:Try this insteadCode: Select all
#define TELE_TERRAIN_ON [event] name=moveto first_time_only=no [if] [have_location] terrain=Rrc [filter] side=$side_number [/filter] [/have_location] [then] [store_locations] variable=telea [filter] [filter_location] terrain=Rrc [/filter_location] [not] x,y=$x1,$y1 [/not] [/filter] [/store_locations] [teleport] [filter] x,y=$x1,$y1 [/filter] x=$telea.x y=$telea.y [/teleport] [redraw] [/redraw] [/then] [/if] [/event] #enddef
Edit--------
Ive done some further investigating.
I'ts now confirmed that its the "store location" thats my only problem,
I tried to set the teleport coordinates to 3,3 instead of $telea.x/y
and that unit in fact got teleported to 3,3
That proves that the filtering in the beginning of the macro is correct.
Code: Select all
#define TELE_TERRAIN_ON
[event]
name=moveto
first_time_only=no
[if]
[have_unit]
side=$side_number
[filter_location]
terrain=Rrc
[/filter_location]
[/have_unit]
[then]
# This part is what doesnt work -.-
[store_locations]
variable=telea
[filter_location]
terrain=Rrc
[not]
x,y=$x1,$y1
[/not]
[/filter_location]
[/store_locations]
# To here
[teleport]
[filter]
x,y=$x1,$y1
[/filter]
x=$telea.x
y=$telea.y
[/teleport]
[redraw]
[/redraw]
[/then]
[/if]
[/event]
#enddef
Edit-------
I found one more problem
"[filter]: a StandardUnitFilter. The locations reachable by any of the matching units will be stored."
The location i want to store is out of reach for the unit, that may be why filter doesn't work ??
Flyro
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987
Re: Why dont this work?
Your problem is that [filter_location] is not part of StandardLocationFilter and thus has no meaning inside [store_locations].
Re: Why dont this work?
¨zookeeper wrote:Your problem is that [filter_location] is not part of StandardLocationFilter and thus has no meaning inside [store_locations].
You're probably right, but unless you wright it as a code I wont understand what you mean
Besides its already solved.
TY for trying to help though, its not your fault i didn't understand
Spoiler:
Flyro
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987
Re: Working useful macros!
You want the Transport galleon to carry units?
Just add these macros to the prestart event.
Just add these macros to the prestart event.
Spoiler:
Flyro
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987
Ultimate campaign http://forums.wesnoth.org/viewtopic.php ... 87#p482987