Help with filtering inside weapon specials
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.
Help with filtering inside weapon specials
For my project im trying to make a new weapon special for magic attacks
This attack should be more powerful when friendly magic units are standing around the attacker
Somehow the filter seems not to work
The ability shows up properly if the filter is commented out.
Thank you Sir Iwein
This attack should be more powerful when friendly magic units are standing around the attacker
Somehow the filter seems not to work
Code: Select all
#define WEAPON_SPECIAL_CHANNELING
[damage]
id=channeling-n
name= _ "channeling"
description= _ "Channeling: This unit inflicts additional damage for every friendly magical unit standing next to this unit."
[filter_adjacent]
adjacent=n
[filter_weapon]
special=magical
[/filter_weapon]
[/filter_adjacent]
add=1
apply_to=self
active_on=offense
cumulative=yes
[/damage]
#[damage]
# id=channeling-nw
#repeating this four all 6 directions
# [/damage]
#enddef
The ability shows up properly if the filter is commented out.
Thank you Sir Iwein
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: Help with filtering inside weapon specials
Your filter is a bit mucked up:
You can only use certain types of filter in certain places - [filter_adjacent] isn't accepted directly by [ability] (which is why it needs to be inside [filter]), and [filter_weapon] can't be used inside a standard unit filter, which is why I suggest providing a list of unit types that trigger the power (alternately, you could change the condition to something easier to check for, like possession of the channeling special ability).
Also, if you want the ability to be visible on the unit when there are no adjacent units triggering it, you have to add name_inactive= and description_inactive= lines to the ability (these can just contain the same values as name_inactive and description_inactive, in which case they will appear the same whether you're receiving the bonus or not).
Code: Select all
[filter]
[filter_adjacent]
count=1
adjacent=n
is_enemy=no
type=<put list of units that trigger this power here>
[/filter_adjacent]
[/filter]
Also, if you want the ability to be visible on the unit when there are no adjacent units triggering it, you have to add name_inactive= and description_inactive= lines to the ability (these can just contain the same values as name_inactive and description_inactive, in which case they will appear the same whether you're receiving the bonus or not).
Re: Help with filtering inside weapon specials
I tried your filter, but it seems not to work, the special is active the whole time.
I was a bit unprecice in the first post, the code is inside a [specials] tag, and not and [ability] tag, this is possibly why the filter does not work.
In the wikiarticle about Abilities it says filters should work inside special tags, but i have nowhere seen an example of someone actually using these filters.
I was a bit unprecice in the first post, the code is inside a [specials] tag, and not and [ability] tag, this is possibly why the filter does not work.
In the wikiarticle about Abilities it says filters should work inside special tags, but i have nowhere seen an example of someone actually using these filters.
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: Help with filtering inside weapon specials
Sorry, I didn't realize it was a weapon special (I guess I just read through it too quickly).
[filter_adjacent] is valid inside of a weapon special, but it still won't accept [filter_weapon] inside of a standard unit filter (such as [filter_adjacent]).
And the point about name_inactive and description_inactive still holds - name and description are only used when the conditions in the filters are met.
[filter_adjacent] is valid inside of a weapon special, but it still won't accept [filter_weapon] inside of a standard unit filter (such as [filter_adjacent]).
And the point about name_inactive and description_inactive still holds - name and description are only used when the conditions in the filters are met.
Re: Help with filtering inside weapon specials
Thank you for your reponses, it works now.
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: Help with filtering inside weapon specials
Glad I could help, and sorry about the initial confusion.