filter_adjacent in resistance tag not working
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: 20
- Joined: June 22nd, 2022, 8:57 pm
filter_adjacent in resistance tag not working
After adding the filter_adjacent the ability remains permanently disabled.
Code: Select all
[effect]
apply_to=new_ability
[abilities]
mode=append
[resistance]
id=shields_up
name= _ "Shields Up"
description= _ "By grouping up with 2 other allies, this unit’s resistances are increased by 10, up to a maximum of 50%, when defending against ranged attacks."
affect_self=yes
active_on=defense
[filter_adjacent]
count=2-6
is_enemy=no
[/filter_adjacent]
[filter_second_weapon]
range=ranged
[/filter_second_weapon]
[filter_base_value]
less_than=50
[/filter_base_value]
add=10
max_value=50
[/resistance]
[/abilities]
[/effect]
Re: filter_adjacent in resistance tag not working
mode=append looks made up, but this example should work anyways.
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
What version of Wesnoth are you using? Before 1.19.10 you must use [filter_adjacent] in a [filter] tag for this to work.
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
You should use that:
Code: Select all
[effect]
apply_to=new_ability
[abilities]
[resistance]
id=shields_up
name= _ "Shields Up"
description= _ "By grouping up with 2 other allies, this unit’s resistances are increased by 10, up to a maximum of 50%, when defending against ranged attacks."
affect_self=yes
active_on=defense
[filter]
[filter_adjacent]
count=2-6
is_enemy=no
[/filter_adjacent]
[/filter]
[filter_second_weapon]
range=ranged
[/filter_second_weapon]
[filter_base_value]
less_than=50
[/filter_base_value]
add=10
max_value=50
[/resistance]
[/abilities]
[/effect]
Re: filter_adjacent in resistance tag not working
Is that really true? The documentation for [filter_adjacent] says specifically not to do that.newfrenchy83 wrote: ↑June 9th, 2025, 12:57 pm you must use [filter_adjacent] in a [filter] tag for this to work.
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
Yes I'm sure, try it and you'll see.gnombat wrote: ↑June 9th, 2025, 1:20 pmIs that really true? The documentation for [filter_adjacent] says specifically not to do that.newfrenchy83 wrote: ↑June 9th, 2025, 12:57 pm you must use [filter_adjacent] in a [filter] tag for this to work.
Re: filter_adjacent in resistance tag not working
Surely the wiki needs to be fixed then? Isn't it telling people to do the exact opposite of that?
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
i will fix the wiki
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
That does not make sense. You said to use [filter] in standard unit filter, which is not allowed still, we have open issue https://github.com/wesnoth/wesnoth/issues/4316
And https://wiki.wesnoth.org/AbilitiesWML still does not say anything about version 1.19.10
And https://wiki.wesnoth.org/AbilitiesWML still does not say anything about version 1.19.10
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
i corrected the wiki
Re: filter_adjacent in resistance tag not working
Wiki was still not good enough, I removed your change from SUF and added devfeature in abilities instead. It does not make much sense though since abilities have supported [filter_adjacent] since 2006 https://wiki.wesnoth.org/index.php?titl ... ldid=11553
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
I think you misunderstood, it was before version 1.19.10 that the fact that the first unit checked did not match caused the ability to be inactive even if others matched, after that, this fault was fixed so that the verification continues and that only if no unit checked matches the standard filter or the condition of number or direction, then we have a false return, and this prevents the verification of a second [adjacent_filter]Ravana wrote: ↑June 9th, 2025, 6:50 pm Wiki was still not good enough, I removed your change from SUF and added devfeature in abilities instead. It does not make much sense though since abilities have supported [filter_adjacent] since 2006 https://wiki.wesnoth.org/index.php?titl ... ldid=11553
-
- Code Contributor
- Posts: 202
- Joined: October 6th, 2017, 12:57 pm
Re: filter_adjacent in resistance tag not working
I changed the wiki to interger the repair in 1.19.10, and I have a question, is it normal for you that all the [filter_adjacent] must match for the ability to be active, would it not be more logical for the ability to activate a single [filter_adjacent] match
Re: filter_adjacent in resistance tag not working
Count determines how many adjacent units must match.