filter_self and formula or filter_wml
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.
- Celtic_Minstrel
- Developer
- Posts: 2436
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: filter_self and formula or filter_wml
Ah, right – so that's the main difference.
[filter] determines whether or not the ability is active, so if that filter doesn't pass, the ability is inactive and had no effect whatsoever. On the other hand [filter_self] determines whether or not the ability affects the owner – even if the filter doesn't pass, it might affect other units.- Spannerbag
- Posts: 876
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: filter_self and formula or filter_wml
Many thanks for the clarification, the documentation makes sense now.
Previously when I read:
I'd understood that to mean that it has the same effect ashttps://wiki.wesnoth.org/AbilitiesWML#Common_keys_and_tags_for_every_ability wrote:[filter]: StandardUnitFilter If the unit owning the ability does not match this filter, the ability will be inactive.
[filter_self] - I hadn't thought of the situation you describe.So
[filter_self] was working but not producing the effect I expected. D'Oh! Celtic_Minstrel wrote: ↑November 11th, 2025, 3:07 am I'm pretty sure the two tags do slightly different things, but… the documentation does a very bad job of explaining it, that's for sure.
Do you think it would be clearer/more consistent if
[filter_self] was renamed [affect_self]?(Cf.
[affect_adjacent] & [filter_adjacent].)Thanks again for the clarification, very helpful!
Cheers!
-- Spannerbag
- Spannerbag
- Posts: 876
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: filter_self and formula or filter_wml
Interesting and live topics/discussions (both have recent posts), thanks for letting me know.
FWIW I kinda view abilities and specials as close relatives and although this'll never happen (and may not be possible as I haven't thought it through fully) I wonder if it's possible to have abilities and specials share the same keys and tags but differ only in that abiltities have a
[filter] as their on/off switch whereas specials have [filter][filter_weapon]. If an ability needs a weapon filter it could go in the appropriate "sub-filter" (e.g. [filter_self] etc.) rather than [filter].Thanks again.
Cheers!
-- Spannerbag
Re: filter_self and formula or filter_wml
Some of complexity is due to abilities that grant weapon special to unit. At this point I dont think we will get any agreement to make changes, so just need to make sure documentation is understandable.
- Celtic_Minstrel
- Developer
- Posts: 2436
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: filter_self and formula or filter_wml
They are certainly close relatives, but I would say that they are very much not the same thing. That said, using
[filter_self] for two completely different meanings in each of them seems bad.