Does [filter_vision] check for whether the unit is stealthed

The place to post your WML questions and answers.

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.
Post Reply
User avatar
A Guy
Posts: 790
Joined: May 24th, 2008, 1:55 am

Does [filter_vision] check for whether the unit is stealthed

Post by A Guy »

I can't really find it. I've read before in the wiki that it just checked for whether the sides could see the hex the unit was on, but now I'm reading something different. I'm confused.
I'm just... a guy...
I'm back for now, I might get started on some work again.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Does [filter_vision] check for whether the unit is steal

Post by Sapient »

The documentation seems a bit wrong... as I recall, filter_vision works for units, not locations.
And if a unit is stealthed, obviously it is not visible to enemies.

I guess it has been changed since I wrote the feature because then it says "in Wesnoth 1.6.4 visible=yes filters for units (visible or invisible) in visible locations. Filtering for unit (in)visibility requires visible=no." I have read that sentence about ten times and it still doesn't make much sense to me, though. :hmm:

The source code is pretty straightforward at least:

Code: Select all

	 if (visible != not_fogged && not_hiding) {
              return false;
So for each viewing side, if the unit's location is not obscured by fog and the unit is not hiding, then it is considered "visible"
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Anonymissimus
Inactive Developer
Posts: 2460
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Does [filter_vision] check for whether the unit is steal

Post by Anonymissimus »

There is a filter_vision in SLF since 1.11.0-svn. IIRC it was a patch by Brilliand which I appllied. He made the documentation. This doesn't apply for the thread of course, since there is no release out there yet with the feature.

Seems there is redundant documentation for filter_vision; on this page it's explained better I think: http://wiki.wesnoth.org/FilterWML#Filtering_Vision
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
A Guy
Posts: 790
Joined: May 24th, 2008, 1:55 am

Re: Does [filter_vision] check for whether the unit is steal

Post by A Guy »

Thanks guys.
I'm just... a guy...
I'm back for now, I might get started on some work again.
User avatar
Elvish_Hunter
Forum Moderator
Posts: 1455
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Does [filter_vision] check for whether the unit is steal

Post by Elvish_Hunter »

A Guy wrote:it just checked for whether the sides could see the hex the unit was on
Indeed, as Anonymissimus said, [filter_vision] for locations will be available from 1.11.0. Some time ago, I updated in trunk the scenario Searching for the Runecrafter from SoF. Here there is the new code, so you can see how it will work in the new versions:
How to simulate a sighted location event

Code: Select all

    [event]
        name=moveto

        [filter]
            side=1
        [/filter]
        [filter_condition]
            [have_location]
                x,y=$thur_x,$thur_y
                [filter_vision]
                    visible=yes
                    respect_fog=yes
                    side=1
                [/filter_vision]
            [/have_location]
        [/filter_condition]

        [scroll_to]
            x,y=$thur_x,$thur_y
        [/scroll_to]
        [delay]
            time=250
        [/delay]
        [if]
            [variable]
                name=unit.id
                equals=Krawg
            [/variable]
            [then]
                [message]
                    speaker=Krawg
                    #po: "I see a house in the distance!"
                    message= _ "Iii zeee hoose iiin eee d’zztaaan’eee!" # wmllint: no spellcheck
                [/message]
            [/then]
            [else]
                [message]
                    speaker=unit
                    message= _ "I see a house in the distance!"
                [/message]
            [/else]
        [/if]
    [/event]
Current maintainer of these add-ons:
1.14: The Sojournings of Grog, A Rough Life, The White Troll (co-author), Wesnoth Lua Pack
1.12: Children of Dragons
Post Reply