Filter unit in [have_unit] by abilities

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
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Filter unit in [have_unit] by abilities

Post by LordAwsomeness »

I am currently trying to figure out how to filter units out by the abilities they have in the [have_unit] syntax. does anybody know how I can do that because I dont think my current code is working...

Code: Select all

[event]
	name=side $side_number turn
	first_time_only=no
	[if]
	[have_unit]
			side=$side_number
				[filter_wml]
					ability=la_summoned_decay_0
				[/filter_wml]
	[/have_unit]
	[then]
		[object]
#			id=la_arcaneshield
			silent=yes
			duration=forever
			[effect]
				apply_to=remove_ability
				[abilities]
						[dummy]
							id=la_summoned_decay_0
						[/dummy]
				[/abilities]
			[/effect]
		[/object]
		{LA_ABILITY_SUMMONED_DECAY 10}
		[/then]
		[/if]
[/event]
		
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Filter unit in [have_unit] by abilities

Post by Ravana »

[filter_wml] checks if unit has key "ability" with value "la_summoned_decay_0". filter_wml can check for ability if you include correct surrounding tags, but there should be key for checking for ability by id.
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Filter unit in [have_unit] by abilities

Post by LordAwsomeness »

Ravana wrote: February 16th, 2020, 4:57 pm [filter_wml] checks if unit has key "ability" with value "la_summoned_decay_0". filter_wml can check for ability if you include correct surrounding tags, but there should be key for checking for ability by id.
so how would I filter it properly? like what is an example that you can show me of what I have there that you would do?

EDIT: are you saying I need to include the ability im trying to find along the lines of this:

Code: Select all

				[filter_wml]
					ability.id=la_summoned_decay_0
				[/filter_wml]
				
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Filter unit in [have_unit] by abilities

Post by Ravana »

Normal way to filter for ability would be https://github.com/ProditorMagnus/Agele ... ing.cfg#L5

If you really need to use filter_wml, it is https://github.com/ProditorMagnus/Agele ... #L135-L141
Post Reply