Flying unit resistant to melee

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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

Flying unit resistant to melee

Post by Modrzew » June 5th, 2018, 1:19 pm

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
Code Contributor
Posts: 213
Joined: July 17th, 2010, 7:40 pm

Re: Flying unit resistant to melee

Post by octalot » June 5th, 2018, 1:45 pm

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
Moderator
Posts: 1886
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Flying unit resistant to melee

Post by Ravana » June 5th, 2018, 1:50 pm

Defend and attack only is not AI-only, they work.

User avatar
Modrzew
Posts: 8
Joined: October 16th, 2014, 4:59 pm
Location: Poland

Re: Flying unit resistant to melee

Post by Modrzew » June 5th, 2018, 2:27 pm

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: 9739
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Flying unit resistant to melee

Post by zookeeper » June 6th, 2018, 8:55 pm

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