[solved] damage_type within [harm_unit]

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
white_haired_uncle
Posts: 1208
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

[solved] damage_type within [harm_unit]

Post by white_haired_uncle »

1.19.something

With POWER=48, this is doing 48 damage to enemies with fire resistance 30%. Am I missing something here?

Code: Select all

#define ABILITY_BURNING_AURA POWER
    [harm_unit]
        id=burning_aura {POWER}
        name= _ "burns foes ("+{POWER}+_")"
        female_name= _ "female^burns foes ("+{POWER}+_")"
        description= _ "The unit singes adjacent enemies at the beginning of your turn, causing fire damage of "+{POWER}+_" HP (max. down to 1 HP, never kills)"
        amount={POWER}
        damage_type=fire
        affect_self=no
        affect_allies=no
        affect_enemies=yes
        kill=no
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/harm_unit]
#enddef
damage_type: if present, amount will be altered by unit resistance to the damage type specified.
Last edited by white_haired_uncle on March 19th, 2024, 9:22 pm, edited 1 time in total.
Speak softly, and carry Doombringer.
User avatar
Ravana
Forum Moderator
Posts: 3017
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: damage_type within [harm_unit]

Post by Ravana »

You seem to be trying to use actionWML tag as if it were ability.
white_haired_uncle
Posts: 1208
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: damage_type within [harm_unit]

Post by white_haired_uncle »

Ravana wrote: March 19th, 2024, 1:41 pm You seem to be trying to use actionWML tag as if it were ability.
I guess so? I'm really not sure what that means.

Here is where the macro is invoked.

Code: Select all

        [advancement]
            max_times=1
            id=burning_aura3
            strict_amla=yes
            description= _ "dealing more damage with burning aura"
            image=attacks/fire-beam.png
            require_amla="burning_aura2"
            [effect]
                apply_to=remove_ability
                [abilities]
                    {ABILITY_BURNING_AURA 40}
                [/abilities]
            [/effect]
            [effect]
                apply_to=new_ability
                [abilities]
                    {ABILITY_BURNING_AURA 48}
                [/abilities]
            [/effect]
            {AMLA_DEFAULT_BONUSES}
        [/advancement]
It originally used [heal_unit] with a negative value, which more or less worked okay except that it wouldn't hurt poisoned units. I'm trying to replace that with [harm_unit] and implement a damage_type. If that's not the way to go, I'm open to suggestions. EDIT: Oops, it was originally [heals] not [heal_unit]. I suspect that's important, but I'm not clear yet why.
Last edited by white_haired_uncle on March 19th, 2024, 2:33 pm, edited 1 time in total.
Speak softly, and carry Doombringer.
newfrenchy83
Code Contributor
Posts: 172
Joined: October 6th, 2017, 12:57 pm

Re: damage_type within [harm_unit]

Post by newfrenchy83 »

[harm_unit] must be implemented in a [event]name=attacker hits for what it is work
white_haired_uncle
Posts: 1208
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: damage_type within [harm_unit]

Post by white_haired_uncle »

Okay, looking a bit further, it looks like [abilities] takes certain tags, of which [heals] is one (according to the wiki). And anything else will display, but do nothing. So I guess I need to implement a turn refresh event to do the actual harm.

But what I'm still not clear on, why does this partially work? If [harm_unit] is not valid inside [abilities], why is it doing any damage at all?
EDIT: Because your saved game still has the old ability. Changing the definition doesn't change existing abilities. Idiot.

P.S. Since I'm going to be working on this next, is there a filter I can use to check for units with an ability, something on the order of

Code: Select all

[store_unit]
    side=1
    [filter_wml]
        ability.id=burns_foes
    [/filter_wml]
....
I know that code is wrong, but hopefully demostrates the idea of what I want to accomplish. I just learned about filter_wml which seems useful but I don't think it will get me to the level of abilities. I suspect this will end up being much easier in lua.
Last edited by white_haired_uncle on March 19th, 2024, 9:22 pm, edited 1 time in total.
Speak softly, and carry Doombringer.
User avatar
Ravana
Forum Moderator
Posts: 3017
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: damage_type within [harm_unit]

Post by Ravana »

[filter_wml] lets you do [filter_wml][abilities][harm_unit]value=48. If you want to work with ability id only then use regular filter not [filter_wml].
Post Reply