Filtering many weapons names at [have_unit] [fixed]

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
bejacomune
Posts: 11
Joined: February 20th, 2023, 8:38 am

Filtering many weapons names at [have_unit] [fixed]

Post by bejacomune »

did [has_attack] or has_attack support many weapons names as value?
If no, what is the best way to filter units based on a weapon names macro?
I tried both [has_attack] and has_attack, booth with and without id= but the units passed the filter as it is always true

Code: Select all

   [indent]
 [if]
		 [have_unit]
			[filter]
			id=$unit.id
			has_weapon=$filter_swords
				[filter_location]
					x=$this_loc_store.x
					y=$this_loc_store.y
				[/filter_location]
			[/filter]
		[/have_unit]
		[then]
		[/then]
[/if]	...						
[/indent]
Last edited by bejacomune on February 26th, 2023, 8:49 pm, edited 1 time in total.
User avatar
Pentarctagon
Project Manager
Posts: 5730
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Filtering many weapons names at [have_unit]

Post by Pentarctagon »

99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
bejacomune
Posts: 11
Joined: February 20th, 2023, 8:38 am

Re: Filtering many weapons names at [have_unit]

Post by bejacomune »

Pentarctagon wrote: February 26th, 2023, 8:01 pm As per https://wiki.wesnoth.org/ConditionalAct ... ve_unit.5D:
Do not use a [filter] tag.
This is unbelievable. I checked the pages carefully but I missed this.
Thank you. It is fine now
ps: it work with [has_attack] with multiple weapons. I didn't checked it for has_weapon but logically it should work.
Do you know a macro that check any unit [attack_anime] images and manipulate them by adding for example a halo during attack ?
for example

Code: Select all

[effect]
			apply_to=new_animation
			name=astral-blade
			[attack_anim]
				[filter_attack]
					name=sword
				[/filter_attack]
				[frame]
					image={# unit images during melee attack anime}
					halo=halos/astral-blade-halo-[1-10].png:[1000]
					sound=fire.wav
				[/frame]
			[/attack_anim]
		[/effect]
User avatar
Pentarctagon
Project Manager
Posts: 5730
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Filtering many weapons names at [have_unit] [fixed]

Post by Pentarctagon »

I don't know of a macro that does that.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Ravana
Forum Moderator
Posts: 3314
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Filtering many weapons names at [have_unit] [fixed]

Post by Ravana »

Macro cant do anything that wml cant do.
bejacomune
Posts: 11
Joined: February 20th, 2023, 8:38 am

Re: Filtering many weapons names at [have_unit] [fixed]

Post by bejacomune »

Pentarctagon wrote: February 26th, 2023, 10:51 pm I don't know of a macro that does that.
That's unfortunate :(
But, thank you for helps
Ravana wrote: February 26th, 2023, 11:33 pm Macro cant do anything that wml cant do.
I see. The problem is that I don't know how to change or manipulate a [frame] by checking if the unit have an attack anime or by adding an elements to it such as a halo during attack. Or, What variables call the [attack_anime] of a unit? ( For exemplar: $unit.image)?
If you encounter a such thing easy enough for a beginner , please tell me
Post Reply