Filter by 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.
Filter by terrain?
Could it be possible to add an option in the Standard Unit Filter to filter by terrain ie:
?
Code: Select all
[event]
name=moveto
[filter]
terrain=g
[/filter]
...
[/event]
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Sure, but I mean, what is a motivating example for this feature?Dacyn wrote:Easier and more flexible WMLDave wrote:What would the purpose of this feature be though?
But it doesn't really add anything that WML can't do already...
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
perhaps if you wanted to make lava do damage to units that are on it without needing to specify the coordinates:
I'm not sure about of the syntax, but... you get the idea.
EDIT: syntax corrected
Code: Select all
[event]
name=new turn
first_time_only=no
[store_unit]
[filter]
terrain=l
[/filter]
variable=victims
[/store_unit]
{FOREACH victims i}
{VARIABLE_OP victims[$i].hitpoints add -10}
[unstore_unit]
variable=victims[$i]
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE victims}
[/event]
EDIT: syntax corrected
Last edited by MadMax on August 16th, 2004, 3:28 pm, edited 1 time in total.
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
It allows the player to undo more of the time.Dacyn wrote:Easier and more flexible WMLDave wrote:What would the purpose of this feature be though?
But it doesn't really add anything that WML can't do already...
Play a Silver Mage in the Wesvoid campaign.
The idea is that if lava terrain were ever added, you could dump that into a global file in a campaign and every scenario would have that without specifying coordinates. Also, didn't EP propose a 'pillage' ability? This would make it possible.
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Did filtering by terrain get implemented?
Suppose I have a map that is half caves and half surface world. I want to set a filter to make the cave floor and cave wall terrains "underground" according to the clock. I could do this manually, listing every hex I want to make underground, or it would be much faster to be able to filter by terrain type. I might still have to go in and list the castle hexes of an underground base, but I wouldn't have to list all the normal underground cave floors and walls.
Suppose I have a map that is half caves and half surface world. I want to set a filter to make the cave floor and cave wall terrains "underground" according to the clock. I could do this manually, listing every hex I want to make underground, or it would be much faster to be able to filter by terrain type. I might still have to go in and list the castle hexes of an underground base, but I wouldn't have to list all the normal underground cave floors and walls.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
No.MadMax wrote:Also, didn't EP propose a 'pillage' ability? This would make it possible.
I didn't propose it.
It isn't impossible.
This feature would be useful.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
This seriously would be a useful feature. From my scenario Weldyn Under Attack, in EI:
If i ever want to change that map, i will have to go through it again, listing each and every mountain tile. A filter by terrain would solve this problem.
I encounter similar problems in other scenarios i design for SE.
Code: Select all
#define TERRAIN_Y
#argh!!! terrain= should be a filter! (or is it? this might have all been pointless... :( )
x=10-13,23,24,25,26,27,28-31,32,39,40,39,38,34,33,32,31,30,29-28,10,11-12,12,13,13-14,15-16,4,5
y=6,6,5,6,5,6,5,4,8-11,11-16,17-18,18,25,26-28,28-29,30-31,31-33,34,27-29,30,31,32,33,34,11-16,17-20
#enddef
Code: Select all
[event]
name=moveto
[filter]
{TERRAIN_Y}
side=5,6,7
[/filter]
[message]
description=Gweddry
message= _ "Look, the undead are tearing down our defences!"
[/message]
[/event]
[event]
name=moveto
first_time_only=no
[filter]
{TERRAIN_Y}
side=5,6,7
[/filter]
[terrain]
x,y=$x1,$y1
letter=h
[/terrain]
[/event]
I encounter similar problems in other scenarios i design for SE.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
Hi,
... sorry, the code is not tested but it should work...
CU, Olf
maybe you could use something like this perl-script as a workaround:turin wrote:This seriously would be a useful feature. From my scenario Weldyn Under Attack, in EI:
Code: Select all
#!/usr/bin/perl
use strict;
use warnings;
my $content = join("", <>);
my ($map) = ($content =~ /map_data="([^"]*)"/sg);
my @lines = split /\n/, $map;
my %terrain = ();
foreach my $y ( 0..$#lines ) {
my @chars = split //, $lines[$y];
foreach my $x ( 0..$#chars ) {
push @{$terrain{$chars[$x]}{x}}, $x;
push @{$terrain{$chars[$x]}{y}}, $y;
}
}
foreach my $terrain ( sort keys %terrain ) {
print '#define TERRAIN_' . "$terrain\n";
print "x=" . join(",", @{$terrain{$terrain}{x}}) . "\n";
print "y=" . join(",", @{$terrain{$terrain}{y}}) . "\n";
print '#enddef ' . "\n";
}
CU, Olf
Re: Filter by terrain?
Has it been implemented ?
I would need it for a scenario I'm working on...
I would need it for a scenario I'm working on...
Re: Filter by terrain?
This thread is from 2005 (!). Yes, this has been implemented, see [filter_location] in https://wiki.wesnoth.org/StandardUnitFilter.