Is there any way to filter units without ability?
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.
- Quetzalcoatl
- Posts: 207
- Joined: March 18th, 2009, 3:26 pm
Is there any way to filter units without ability?
Is there any way to filter units without ability? I was looking for it at wiki and forums but didn't find anything.
For example I would like to store units that doesn't have submerge or regeneration.
What I'm trying to do is to heal unit when all other units heals (between turn start and turn refresh).
I thought the best solution would be to modify unit at turn start (give regenerates) and remove this ability at turn refresh.
For example I would like to store units that doesn't have submerge or regeneration.
What I'm trying to do is to heal unit when all other units heals (between turn start and turn refresh).
I thought the best solution would be to modify unit at turn start (give regenerates) and remove this ability at turn refresh.
Ten soldiers wisely led will beat a hundred without a head.
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
Re: Is there any way to filter units without ability?
http://wiki.wesnoth.org/StandardUnitFilter lists ability id as something you can filter. So...
Code: Select all
[filter]
[not]
ability=regenerates
[/not]
[/filter]
Re: Is there any way to filter units without ability?
Code: Select all
[filter]
[not]
ability=submerge
[or]
ability=regenerates
[/or]
[/not]
[/filter]
edit: Ken beat me to it
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
- Quetzalcoatl
- Posts: 207
- Joined: March 18th, 2009, 3:26 pm
Re: Is there any way to filter units without ability?
Thx
, somehow i missed it
Here is the WML that do healing between turn start and turn refresh (that means no problems with labels, healing animations, regeneration and such - maybe it would be useful for somebody else):
This will do healing exactly like village on any x y hex.


Here is the WML that do healing between turn start and turn refresh (that means no problems with labels, healing animations, regeneration and such - maybe it would be useful for somebody else):
Code: Select all
[event]
name=side turn
first_time_only=no
{VARIABLE south_rune_used no}
[object]
silent=yes
[filter]
side=$side_number
x,y=9,18
[not]
ability=regenerates
[/not]
[/filter]
[then]
{VARIABLE south_rune_used yes}
[/then]
[effect]
apply_to=new_ability
[abilities]
{ABILITY_REGENERATES}
[/abilities]
[/effect]
[/object]
[/event]
[event]
name=turn refresh
first_time_only=no
[if]
[variable]
name=south_rune_used
equals=yes
[/variable]
[then]
[object]
silent=yes
[filter]
side=$side_number
x,y=9,18
[/filter]
[effect]
apply_to=remove_ability
[abilities]
{ABILITY_REGENERATES}
[/abilities]
[/effect]
[/object]
[/then]
[/if]
{CLEAN_VARIABLE south_rune_used}
[/event]
Ten soldiers wisely led will beat a hundred without a head.
Re: Is there any way to filter units without ability?
ah, very clever.
you should add this to the Useful WML Snippets page on the wiki
you should add this to the Useful WML Snippets page on the wiki
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: Is there any way to filter units without ability?
I did not try this, but doesn't this remove the regeneration ability from units that already have them?Quetzalcoatl wrote:Thx, somehow i missed it
![]()
Here is the WML that do healing between turn start and turn refresh (that means no problems with labels, healing animations, regeneration and such - maybe it would be useful for somebody else):This will do healing exactly like village on any x y hex.Code: Select all
...
Re: Is there any way to filter units without ability?
Good point. Something like this should fix that:pauxlo wrote:I did not try this, but doesn't this remove the regeneration ability from units that already have them?Quetzalcoatl wrote:Thx, somehow i missed it
![]()
Here is the WML that do healing between turn start and turn refresh (that means no problems with labels, healing animations, regeneration and such - maybe it would be useful for somebody else):This will do healing exactly like village on any x y hex.Code: Select all
...
Code: Select all
[effect]
apply_to=new_ability
[abilities]
{ABILITY_REGENERATES}
[+regenerate]
id=fakeregenerates
[/regenerate]
[/abilities]
[/effect]
Code: Select all
[effect]
apply_to=remove_ability
[abilities]
id=fakeregenerates
[/abilities]
[/effect]
- Quetzalcoatl
- Posts: 207
- Joined: March 18th, 2009, 3:26 pm
Re: Is there any way to filter units without ability?
It doesn't remove any attributes form units that have it already
Thats why I asked how to filter units without ability
However regeneration with fake id its a lot better solution than having temp variables and extra conditions and I wasn't aware before that this can be done that way.
So here is the updated WML (as macro this time):
I will try to post this on wiki sometime soon.


So here is the updated WML (as macro this time):
Code: Select all
#define HEALING_PLACE X Y
[event]
name=side turn
first_time_only=no
[object]
silent=yes
[filter]
side=$side_number
x,y={X},{Y}
[/filter]
[effect]
apply_to=new_ability
[abilities]
{ABILITY_REGENERATES}
[+regenerate]
id=fake_regenerates
[/regenerate]
[/abilities]
[/effect]
[/object]
[/event]
[event]
name=turn refresh
first_time_only=no
[object]
silent=yes
[filter]
side=$side_number
x,y={X},{Y}
[/filter]
[effect]
apply_to=remove_ability
[abilities]
[regenerate]
id=fake_regenerates
[/regenerate]
[/abilities]
[/effect]
[/object]
[/event]
#enddef
Ten soldiers wisely led will beat a hundred without a head.