Ability problems, making era

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
siddh
Posts: 192
Joined: August 30th, 2009, 5:54 pm

Ability problems, making era

Post by siddh »

Hello I'm making this era called "draconian era", im not sure if I finish this or not, since it's gonna be a lot of work, but I've done some so far. Anyway there's some problems with WML when I'm trying to make these abilities. You can also download the era from hte add-on server, although there aint much to see. :D

Problem 1: Mountainhide

Code: Select all

#define ABILITY_MOUNTAINHIDE
    [hides]
        id=draconian_mountainhide
        name= _ "Mountainhide"
        female_name= _ "Mountainhide"
        description= _ "Mountainhide:
This unit can hide in mountains, and remain undetected by its enemies."

        affect_self=yes
        [filter_self]
            [filter_location]
                terrain=*^Mm,*^Md
            [/filter_location]
        [/filter_self]
    [/hides]
#enddef
Doesn't seem to work :D Any ideas?

Problem 2: Making an ability that reduces target's defense and/or resistance
Well I don't know how to do that. Weaponspecial that is.

Problem 3: Unpoison with terrain filter, not sure if this works, coz I have not tested it yet (so it could work already)

Code: Select all

#define ABILITY_HERBALISM
    [heals]
        affect_allies=yes
        id=draconian_herbalism
        name= _ "Herbalism"
        female_name= _ "female^Herbalism"
        description= _ "Herbalism:
This unit can find herbs that grow in the foothills of mountains to cure poison."
        affect_self=yes
        poison=cured
        [filter_self]
            [filter_location]
                terrain=H*^F*
            [/filter_location]
        [/filter_self]
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/heals]
#enddef
Problem 4: Warfan, this is an ability which would allow a unit to gain defense against ranged attacks, with type filter. Again, I've not tested this, so it might work. But since I'm writing this now I'll add it here as well just incase

Code: Select all

#define ABILITY_WARFAN
    [defense]
        id=draconian_warfan
        name= _ "War Fan"
        description= _ "War Fan:
This unit can use the war fan to defend against ranged attacks and receives 15 point defense increase against ranged attacks."
        [filter]
            [filter_weapon]
		    range=ranged
                type=blade,pierce,impale,impact
            [/filter_weapon]
        [/filter]
        add=15
        max_value=80
        apply_to=self
    [/defense]
#enddef
Anyway the mountainhide thing is the mainproblem atm since I've not tried the other things so I dont know if there's a problem and/or if there is a problem do I find the solution on my own. Anyway.. Kk thx for any help in advance. :D
Last edited by 8680 on May 18th, 2013, 6:26 am, edited 1 time in total.
Reason: Added [code] tags per forum rules (clearly visible above the posting interface).
User avatar
Celtic_Minstrel
Developer
Posts: 2376
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Ability problems, making era

Post by Celtic_Minstrel »

Well, for problem 1, the issue is that mountains aren't an overlay, so you need the ^ on the other side (or possibly not at all). Basically, use Mm^* instead of *^Mm (or even just Mm).

If you test 3 and 4 and find them to not work, maybe I'll have a look at them.

Problem 2... that's not going to be possible purely with a weapon special, I think. You'd probably need to use an [object] that's added and then removed later, sort of how the stun ability from Dead Water works. Check out the code for that scenario, as well as this page.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Ability problems, making era

Post by 8680 »

siddh wrote:Problem 1
Try terrain="M*,M*^*".
siddh wrote:Problem 2: Making an ability that reduces target's defense and/or resistance Well I don't know how to do that. Weaponspecial that is.
I don’t know how to do that with a weapon special, but rather than decreasing the defender’s defense or resistance, you can increase the attacker’s chance-to-hit or damage. See also Problem 4, where I effectively increase the unit’s defense by decreasing its enemy’s chance-to-hit.
siddh wrote:Problem 3: Unpoison with terrain filter, not sure if this works, coz I have not tested it yet (so it could work already)
I see nothing wrong with this.
siddh wrote:Problem 4: Warfan, this is an ability which would allow a unit to gain defense against ranged attacks, with type filter.
Try this:

Code: Select all

#define WEAPON_SPECIAL_FAN_SHIELD
    [chance_to_hit]
        id="draconian_warfan"
        ## This will appear in the war fan’s attack definition,
        ## so naming it “war fan” would be redundant.
        name= _ "shielding fan"
        description= _ "This fan increases its wielder’s defense against ranged blade, pierce, impale, and impact attacks by 15 percentage points, to a maximum of 80%."
        apply_to=opponent
        [filter_opponent]
            [filter_weapon]
                range=ranged
                type=blade,pierce,impale,impact
            [/filter_weapon]
        [/filter_opponent]
        sub=15
        [filter_base_value]
            greater_than_equal_to=35
        [/filter_base_value]
    [/chance_to_hit]
#enddef
siddh
Posts: 192
Joined: August 30th, 2009, 5:54 pm

Re: Ability problems, making era

Post by siddh »

kk thx both 8680 and celtic :D
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Ability problems, making era

Post by 8680 »

From [url=ircs://chat.freenode.net:7000/#wesnoth]IRC[/url] [log]:
<siddh> btw you got your reply a bit wrong _8680_ the name isnt redundant since the id is the unique id, also it was a unit ability and not a weapon special, but I assume that your fix for the filter was correct :D
<_8680_> siddh: An ability can’t alter defense/chance-to-hit, so it would need to be a weapon special.
<_8680_> siddh: If it’s a weapon special, calling it “war fan” (the name of the attack that it’s attached to) would look redundant.
<siddh> oh that's strange
<siddh> given how there's steadfast and such I thought the same would work for defense
<siddh> hmm well that complicates things since the unit isnt supposed to have a ranged attack :D
<_8680_> Oh. I quite forgot that the non-ranged war-fan wouldn’t apply against a ranged attack.
<_8680_> Yes, that does complicate things badly. My apologies.
One solution would be to give the unit, in addition to its normal melee war fan attack, a “ranged” war fan “attack”, with no damage and no strikes:

Code: Select all

[attack]
    name=warfan-shield
    description= _ "war fan"
    ## I believe that having an attack with 0 damage and 0 strikes
    ## was impossible in older Wesnoth versions; I do not know if it
    ## is possible now. If it is not, try using nameless [damage]
    ## and [attacks] weapon specials to set these attributes to 0.
    damage=0
    number=0
    range=ranged
    type=?
    [specials]
        [chance_to_hit]
            id="draconian_warfan_shield"
            name= _ "fan shield"
            description= _ "This unit can use its fan to shield itself against against ranged blade, pierce, impale, and impact attacks, increasing its defense against such attacks by 15 percentage points, to a maximum of 80%."
            apply_to=opponent
            [filter_opponent]
                [filter_weapon]
                    type=blade,pierce,impale,impact
                [/filter_weapon]
            [/filter_opponent]
            sub=15
            [filter_base_value]
                greater_than_equal_to=35
            [/filter_base_value]
        [/chance_to_hit]
    [/specials]
[/attack]
siddh
Posts: 192
Joined: August 30th, 2009, 5:54 pm

Re: Ability problems, making era

Post by siddh »

I'll have to think about this fan ability.

Anyway the mountainhide works now, meanwhile "herbalism" doesn't. Or it's complicated. The cure works on the unit itself exactly as planned, but the filter doesn't apply to allies. So the unit cures allies regarless of the terrain the unit or the allied unit is on, and this should be fixed but I don't know how.

Any ideas? :D
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Ability problems, making era

Post by 8680 »

siddh wrote:Any ideas? :D
Try changing [filter_self] to [filter].
siddh
Posts: 192
Joined: August 30th, 2009, 5:54 pm

Re: Ability problems, making era

Post by siddh »

thx it works now :)
User avatar
Azeal
Posts: 97
Joined: July 24th, 2012, 8:19 am

Re: Ability problems, making era

Post by Azeal »

For problem 2 do you want to lower resistance for the duration of the attack or permanently?

This should work for the first one

Code: Select all

#define WEAPON_SPECIAL_LOWER_RES
    [dummy]
        id=lower_res
        name= _ ""
        name_inactive= _ ""
        description= _ ""
        description_inactive= _ ""
    [/dummy]
[/specials]
[/attack]
[event]
    name=attack
    first_time_only=no
    [filter_attack]
        special=lower_res
    [/filter_attack]
    {VARIABLE_OP second_unit.resistance.insert_type add 10}
    [unstore_unit]
        variable=second_unit
    [/unstore_unit]
[/event]
[event]
    name=attack_end
    first_time_only=no
    [filter_attack]
        special=lower_res
    [/filter_attack]
    {VARIABLE_OP second_unit.resistance.insert_type sub 10}
    [unstore_unit]
        variable=second_unit
    [/unstore_unit]
[/event]
[+attack]
    [+specials]
#enddef

I have a weapon special that gives a permanent resistance debuff (each unit can only get it once) so if that's what you want let me know and I'll post it.

For defense just substitute the second_unit.resistance.insert_type variable for second_unit.defense.terrain
Post Reply