how ban a weapon,if defence unit have a abilities
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.
how ban a weapon,if defence unit have a abilities
i need block a wespon attack have abilities ID "FI",but can use defence,how do?
Re: how ban a weapon,if defence unit have a abilities
This sounded like tricky challenge, so I tried it out. wesnoth.get_units{formula="abilities"} worked to find units with abilities, so in filter you can use formula=abilities.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: how ban a weapon,if defence unit have a abilities
I'm not sure I understand the question correctly, but weapons don't have abilities. If you mean "weapon special," this code shows how I would do it. This "ability" currently blocks all magical attacks. You can modify it to block the weapon special you want. The weapon special could filter the attacker based on that unit's ability instead if that is what you want. You could #define it and add it to all of a unit's attacks as well.
Code: Select all
# This ability does nothing except allow the user to see it. The affect is
# really acheived by the weapon special. (You don't need to use "dummy". You
# can use any tag that doesn't already exist.)
[abilities]
[dummy]
id=dummy
name= _ "magic blocker"
description="This unit blocks ranged magical attacks when on defense, but takes normal magical retaliation when attacking."
[/dummy]
[/abilities]
[attack]
[specials]
[attacks]
id=block_magic
# There is no description here because it is in the ability.
name= _ "block magic"
value=0 # The new number of attacks.
apply_to=opponent # Affects opponent only.
[filter_attacker] # Applies when that opponent is attacking.
[filter_weapon]
special=magical
[/filter_weapon]
[/filter_attacker]
[/attacks]
[/specials]
# This part stays normal.
name=stare
description=_ "stare"
icon="attacks/gaze.png"
type=arcane
range=ranged
damage=6
number=3
[/attack]
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide