Need help with custom ability/special

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
Ranger
Posts: 122
Joined: March 15th, 2013, 10:22 pm
Location: Salerno, Italy

Need help with custom ability/special

Post by Ranger »

I'm trying to make a custom type of unit that resists damage of any type applied by melee attacks.
So far I came up with this special:

Code: Select all

#define WEAPON_SPECIAL_FIGHTER
    [damage]
        id=fighter
        name= _ "fighter"
        description= _ "This unit takes less damage in melee combat."
        [filter_weapon]
			range=melee
		[/filter_weapon]
		multiply=0.75
        apply_to=opponent		
    [/damage]
#enddef
To apply to unit's melee weapon. But if I would like them to have an ability that does the same effect, what should I do?
Calling a spear a spoon and then saying "our spoons are different, WINR," is kind of unsatisfying, isn't it?
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Need help with custom ability/special

Post by Ravana »

Event-based ability. You need to interrupt combat and change damage.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Need help with custom ability/special

Post by zookeeper »

Ranger wrote:To apply to unit's melee weapon. But if I would like them to have an ability that does the same effect, what should I do?
Aside from Ravana suggested, you can't. But if all units having the special/ability do have a melee attack, just make the special invisible and add a dummy ability.
User avatar
Ranger
Posts: 122
Joined: March 15th, 2013, 10:22 pm
Location: Salerno, Italy

Re: Need help with custom ability/special

Post by Ranger »

ok, thx. I'll see what I do with that.
Calling a spear a spoon and then saying "our spoons are different, WINR," is kind of unsatisfying, isn't it?
Post Reply