Problems with [filter_ability]

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
Numero
Posts: 21
Joined: August 7th, 2018, 2:11 pm

Problems with [filter_ability]

Post by Numero »

Hey I'm giving some units the hidden skirmisher ability like this and it works:

Code: Select all

            [modify_unit]
                [filter]
                    side=4
                    formula = "self.hitpoints < 12"
                    [not]
                        id = Rormuk the Butcher
                    [/not]
                    [not]
                        role = cowards
                    [/not]
                [/filter]
                moves = "$($this_unit.max_moves)"
                name = $this_unit.name + " the Coward"
                role = cowards
                [abilities]
                    [skirmisher]
                        cumulative=no
                        id=cowardsrun
                        affect_self=yes
                    [/skirmisher]
                [/abilities]
            [/modify_unit]
But it doesn't work, when I want to remove that ability:

Code: Select all

		 [modify_unit]
                        [filter]
                            role = cowards
                            [filter_adjacent] 
                                id = Tragtrad
                            [/filter_adjacent] 
                        [/filter]
                        side = 1
                        [effect]
                            apply_to=remove_ability
                            [filter_ability]
                                id=cowardsrun
                            [/filter_ability]
                        [/effect]
                    [/modify_unit]
Does somebody know the reason and could help me?
User avatar
Ravana
Forum Moderator
Posts: 3014
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Problems with [filter_ability]

Post by Ravana »

[filter_ability] looks correct. You have some non-filter-ability logic in these examples too. Try testing without those.
Soliton
Site Administrator
Posts: 1688
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: Problems with [filter_ability]

Post by Soliton »

It's [experimental_filter_ability] the wiki is not up-to-date.
"If gameplay requires it, they can be made to live on Venus." -- scott
newfrenchy83
Code Contributor
Posts: 172
Joined: October 6th, 2017, 12:57 pm

Re: Problems with [filter_ability]

Post by newfrenchy83 »

in 1.18 the filter ability are yet experimental, it's why you find experiemntal_ in tag_name of filter, it will be removedlater in devellopement branch when some modifications and corrections will be added
white_haired_uncle
Posts: 1206
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Problems with [filter_ability]

Post by white_haired_uncle »

What about

Code: Select all

[filter]
    ability_type_active=cowardsrun
[/filter]
or something similar, I don't know if that would match id=cowardsrun, I suspect not, but I think the idea could be made to work?
Speak softly, and carry Doombringer.
newfrenchy83
Code Contributor
Posts: 172
Joined: October 6th, 2017, 12:57 pm

Re: Problems with [filter_ability]

Post by newfrenchy83 »

try with

Code: Select all

[modify_unit]
                        [filter]
                            role = cowards
                            [filter_adjacent] 
                                id = Tragtrad
                            [/filter_adjacent] 
                        [/filter]
                        side = 1
                        [effect]
                            apply_to=remove_ability
                            [experimental_filter_ability]
                                id=cowardsrun
                                tag_name=skirmisher
                            [/experimental_filter_ability]
                        [/effect]
                    [/modify_unit]
                    
Numero
Posts: 21
Joined: August 7th, 2018, 2:11 pm

Re: Problems with [filter_ability]

Post by Numero »

[experimental_filter_ability] worked,
thanks a lot guys!
Post Reply