Flying unit resistant to melee

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
Modrzew
Posts: 10
Joined: October 16th, 2014, 4:59 pm
Location: Poland

Flying unit resistant to melee

Post by Modrzew »

Hi!

I'm trying to make a flying unit that can only attack with ranged attack and only be hit by ranged attacks. Can someone help me with writing a WML for that? Some skill that prevents others from attacking the unit with melee or maybe giving the unit 100% defense against melee attacks?

I would be grateful for any help :)
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Flying unit resistant to melee

Post by octalot »

You could give the unit a 0-0 melee attack with a weapon special that also reduces damage taken to zero. Example of the opposite of what you want for the weapon special:

Code: Select all

  [damage]
    id=sxc_brutality
    name= _ "brutality"
    description= _ "When this attack is used in offense the unit deals 25% more damage and takes 25% more damage."
    active_on=offense
    apply_to=both
    multiply=1.25
  [/damage]
Ageless Era has some "defend only" attacks that aren't used on offense, but they're on AI-only units, it might just be telling the AI not to use them.
User avatar
Ravana
Forum Moderator
Posts: 2997
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Flying unit resistant to melee

Post by Ravana »

Defend and attack only is not AI-only, they work.
User avatar
Modrzew
Posts: 10
Joined: October 16th, 2014, 4:59 pm
Location: Poland

Re: Flying unit resistant to melee

Post by Modrzew »

Thank you!
I did a bit crude version, but it works. For now it's ok for me.
Thank you :)
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Flying unit resistant to melee

Post by zookeeper »

On the dummy melee attack, you should be able to just use a [disable] special to make it not even appear in the attack menu, and probably to make the AI not consider it either.
Post Reply