Filtering many weapons names at [have_unit] [fixed]
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: 11
- Joined: February 20th, 2023, 8:38 am
Filtering many weapons names at [have_unit] [fixed]
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
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.
- Pentarctagon
- Project Manager
- Posts: 5730
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Filtering many weapons names at [have_unit]
As per https://wiki.wesnoth.org/ConditionalAct ... ve_unit.5D:
Do not use a [filter] tag.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
-
- Posts: 11
- Joined: February 20th, 2023, 8:38 am
Re: Filtering many weapons names at [have_unit]
This is unbelievable. I checked the pages carefully but I missed this.Pentarctagon wrote: ↑February 26th, 2023, 8:01 pm As per https://wiki.wesnoth.org/ConditionalAct ... ve_unit.5D:Do not use a [filter] tag.
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]
- Pentarctagon
- Project Manager
- Posts: 5730
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Filtering many weapons names at [have_unit] [fixed]
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
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Filtering many weapons names at [have_unit] [fixed]
Macro cant do anything that wml cant do.
-
- Posts: 11
- Joined: February 20th, 2023, 8:38 am
Re: Filtering many weapons names at [have_unit] [fixed]
That's unfortunate

But, thank you for helps
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