Quantcast
Channel: The Battle for Wesnoth Forums
Viewing all articles
Browse latest Browse all 2158

WML Workshop • Possible bug with advancement filters not clearing

$
0
0
I say "possible" bug, because it could just be me not understanding something. It's a wml question, so I believe this is the right place to ask.

The code below is simplified from my actual campaign, but I tested it and the problem still happens.

I have these two advancements in my [unit_type] tag. One is the standard +1 Melee damage. The second one gives the character poison immunity, but has a filter to test a variable called "mushrooms". Both advancements work as expected:

Code:

[unit_type]    {CHARACTER_BASE}[advancement]       max_times=2       always_display=yes id=adv_melee       description= _ "+1 melee damage"        image=attacks/sword-human-short.png                [effect]            apply_to=attack            range=melee         increase_damage=1        [/effect]           [effect]           apply_to=variation            name=Stage02        [/effect][/advancement][advancement][filter] formula = wml_vars.mushrooms > 0[/filter]      max_times=2        always_display=yes id=adv_mushroom        description= _ "Mushroom:  Gain poison immunity."        image=icons/herb-bag.png                [effect]            apply_to=statusadd=unpoisonable[/effect]           [effect]           apply_to=variation            name=Stage02        [/effect][/advancement]
You can see that both advancements also progress the character to a new variation called Stage02. The [variation] for Stage02 is below. The advancements are EXACTLY THE SAME, except the order is reversed. This no longer works correctly.

Code:

    [variation]        {CHARACTER_BASE}        variation_id=Stage02        inherit=yes[advancement][filter] formula = wml_vars.mushrooms > 0[/filter]        max_times=2        always_display=yes id=adv_mushroom        description= _ "Mushroom:  Gain poison immunity."        image=icons/herb-bag.png                [effect]            apply_to=statusadd=unpoisonable[/effect]           [effect]           apply_to=variation            name=Stage02        [/effect][/advancement][advancement]        max_times=2        always_display=yes id=adv_melee        description= _ "+1 melee damage"        image=attacks/sword-human-short.png                [effect]            apply_to=attack            range=melee           increase_damage=1        [/effect]            [effect]           apply_to=variation            name=Stage02        [/effect][/advancement][/variation][/unit_type]
The code appears directly after the first block, still inside my [unit_type] tag.

The Melee advancement does not appear when the character advances in the Stage02 variation. There is no filter, and the max_times aren't used up, so it should definitely appear. When I look at the unit in Inspect Mode, I can see the problem. The [filter] for the mushroom variable somehow got imported into the Melee advancement.

So, the obvious work-around is to just not change the order. However, the actual campaign will have more than 2 advancements and I don't really want to have to constantly worry about what order I"m listing them in. Also, it took me HOURS to figure out why the advancement was not appearing, so I thought somebody else might benefit. (I didn't know about inspect mode... :oops: )

So is it a bug, or am I just being dumb? If there is any other work-around, so I don't have to constantly monitor the order, please let me know. Thanks!

Edit: fixed a typo in the code sections, where I had accidentally put max_times=-2 (negative 2). The error still happens with the correct max_times=2.

Statistics: Posted by Ken_Ohio — Yesterday, 10:28 pm



Viewing all articles
Browse latest Browse all 2158

Trending Articles