Working with 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
MerlinCross
Posts: 57
Joined: November 25th, 2014, 5:52 am

Working with Abilities

Post by MerlinCross »

New to this, so this is probably pretty basic.

I'm trying to add a version of a given ability, in this case Regenerate. 8 is a bit much for something that has 10-20 HP so I'm trying to lower the amount to something way more manageable. But it doesn't show up. So, I'm wondering a few things.

1) Where do I put the [abilities] [/abilities] bracket or does it matter? Looking at other unit files, they don't seem to have a set place to put them.

2) How do I actually write this out? So far I have;

Code: Select all

 [abilities]
        [regenerate]
             value=2
             posion=cured
         [/regenerate]
 [/abilities]
That doesn't seem right but the Support/Help section doesn't really list how to write it out.

Thanks for the help in advance.
User avatar
Ravana
Forum Moderator
Posts: 3004
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Working with Abilities

Post by Ravana »

It doesnt matter where you put [abilities], however most eras place that around end of unit_type's key list, so around line 25.

Code: Select all

#define ABILITY_SELFHEAL
    [regenerate]
        value=4
        id=selfheal
        name= _ "self-heal"
        description=_"
The unit will slow the effects of poison on itself or regenerate four hitpoints per turn."
        affect_self=yes
        poison=slowed
    [/regenerate]
#enddef
Similar existing ability
MerlinCross
Posts: 57
Joined: November 25th, 2014, 5:52 am

Re: Working with Abilities

Post by MerlinCross »

Thanks for the first part to my question. I usually put abilities like after the unit description.

But for the second, that didn't seem to work as it doesn't show up in game....hmm...
User avatar
Ravana
Forum Moderator
Posts: 3004
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Working with Abilities

Post by Ravana »

That second one(#define to #enddef) is macro, so you include it with {ABILITY_SELFHEAL}
MerlinCross
Posts: 57
Joined: November 25th, 2014, 5:52 am

Re: Working with Abilities

Post by MerlinCross »

And where do I put that? Placing it in the Unit file messes it up and have no idea where else to put it. Maybe in the marco files for the add on?

Terrible sorry if this seems like really basic stuff that I should know but I can't seem to find info through the support menu. Thanks for your time Ravana. Although at this rate I might just give the unit the Healthy trait.
User avatar
Celtic_Minstrel
Developer
Posts: 2214
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Working with Abilities

Post by Celtic_Minstrel »

I think you might find the wiki useful here - WML syntax and structure of unit type definitions.

If you put the code Ravana gave you in the unit type definition, as long as it's inside the [abilities] tag which is inside the [unit_type] tag and not inside any other tag, it will work provided you leave out the lines starting with #. However, if you want to use the ability on more than one unit, then what you'd usually do is copy the code including the # lines into a separate file which is included by your main config file. Then, you put {ABILITY_SELFHEAL} in your unit type definition in the same place you would've put the other code. Again, it has to be directly within the [abilities] tag.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply