Rest-triggered 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
The_Other
Posts: 189
Joined: February 3rd, 2012, 10:05 pm
Location: UK

Rest-triggered abilities

Post by The_Other »

Can an ability become active only if the unit is rested? Specifically, is it possible to have a unit become hidden if it doesn't move? If so, how?
Nothing is true; everything is permissible.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Rest-triggered abilities

Post by Pentarctagon »

You could check at the end of a turn if the unit with the ability has used any of its movement points. If it hadn't moved, set a variable to whatever value you want to mean it hasn't moved. Then at the start of the next turn, check that variable, and if it is the right value apply the ability to the unit. Then use another event to remove the ability's affects if it moves.
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
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Rest-triggered abilities

Post by zookeeper »

You should be able to do it without any events, using ability filters. Either of these ought to work:

Code: Select all

[hides]
    ...
    [filter]
        [filter_wml]
            resting=yes
        [/filter_wml]
    [/filter]
    ...
[/hides]

[hides]
    ...
    [filter]
        [filter_wml]
            moves=$this_unit.max_moves
        [/filter_wml]
    [/filter]
    ...
[/hides]
User avatar
The_Other
Posts: 189
Joined: February 3rd, 2012, 10:05 pm
Location: UK

Re: Rest-triggered abilities

Post by The_Other »

That's what I was hoping.
Thanks guys!
Nothing is true; everything is permissible.
Post Reply