[resistance_defaults] doesn't work

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
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2356
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

[resistance_defaults] doesn't work

Post by Lord-Knightmare »

Hello, I am trying to add a custom damage type and add resistance values for it for specific movement-types (including some core ones).

Quoted from the WML reference documentation:
[resistance_defaults]
(Version 1.13.2 and later only)

The [resistance_defaults] tag allows you to add resistance for custom damage types to already-defined movetypes (such as core movetypes).

id: The damage type you want to apply resistance defaults for.
default: The default resistance for all movetypes. You can set it to a number, or to a formula (enclosed in parentheses) which can reference any of the default resistance types - arcane, fire, etc. A common usage for formulas might be to set it to be equal to another resistance, eg default="(impact)".
Other keys reference the name= attribute of a defined movetype. For example, 'smallfoot=50' will set the resistance to 50 for the smallfoot movement type. Note: The default= key and other keys are handled slightly differently. A default= value will never override an explicitly specified value either in the same [resistance_defaults] tag or in a [movetype] definition, but other keys always take priority over values specified in a [movetype] definition.
This is the code I added to the _main.cfg file (which loaded without any errors/warnings):

Code: Select all

    [language]
       type_electric= _ "type^electric"
    [/language]
    [resistance_defaults]
        id=electric
        default=100
        undeadfly=130
        undeadfoot=130
        undeadspirit=90
    [/resistance_defaults]
If defined for custom movement types, the desired resistance values are assigned flawlessly. However, for the core movement types using [resistance_defaults][/resistance_defaults], the code does not work. At all.
Any suggestions for rectification or is this tag still in experimental phase?
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
beetlenaut
Developer
Posts: 2822
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [resistance_defaults] doesn't work

Post by beetlenaut »

Are you using [resistance_default] in the proper context? It's only valid inside the [units] tag, while [language] is toplevel.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2356
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [resistance_defaults] doesn't work

Post by Lord-Knightmare »

Are you using [resistance_default] in the proper context? It's only valid inside the [units] tag, while [language] is toplevel.
I have updated the code as follows:

Code: Select all

#define LEGEND_CAMPAIGN

    [binary_path]
       path="data/add-ons/War_of_Legends"
    [/binary_path]

    {~add-ons/War_of_Legends/macros}

    [language]
       type_arcane_focus= _ "type^arcane focus"
       type_electric= _ "type^electric"
    [/language]

    [units]
        [resistance_defaults]
            id=electric
            default=100
            undeadfly=130
            undeadfoot=130
            undeadspirit=90
        [/resistance_defaults]
       {~add-ons/War_of_Legends/units}
    [/units]
#enddef
It's still not working.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Celtic_Minstrel
Developer
Posts: 2194
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [resistance_defaults] doesn't work

Post by Celtic_Minstrel »

Comment out the #define and #enddef lines and it should work. Code between #define and #enddef is ignored unless you later expand the macro with {LEGEND_CAMPAIGN}, but in this specific case you probably shouldn't be defining a macro at all.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2356
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [resistance_defaults] doesn't work

Post by Lord-Knightmare »

Comment out the #define and #enddef lines and it should work. Code between #define and #enddef is ignored unless you later expand the macro with {LEGEND_CAMPAIGN}, but in this specific case you probably shouldn't be defining a macro at all.
I have updated the code again and took the code out the #define and #enddef

Code: Select all

#textdomain wesnoth-War_of_Legends

[textdomain]
    name="wesnoth-War_of_Legends"
    path="data/add-ons/War_of_Legends/translations"
[/textdomain]

[language]
    type_electric= _ "type^electric"
[/language]
[+units]
    [resistance_defaults]
        id=electric
        default=100
        undeadfly=130
        undeadfoot=130
        undeadspirit=90
    [/resistance_defaults]
[/units]
Result: Still doesn't work.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Celtic_Minstrel
Developer
Posts: 2194
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [resistance_defaults] doesn't work

Post by Celtic_Minstrel »

Just checking, but do you actually have units with an electric damage type? If your standard for whether it works is seeing the resistance in help, I think the game will never show damage types that no unit possesses.

If that's not it, please tell me exactly what you do to check that it's working (and conclude that it doesn't).
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2356
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [resistance_defaults] doesn't work

Post by Lord-Knightmare »

Just checking, but do you actually have units with an electric damage type? I
[section]
Screenshot 2020-11-23 051359.png
Screenshot 2020-11-23 051359.png (165.66 KiB) Viewed 718 times
[/section]
If your standard for whether it works is seeing the resistance in help, I think the game will never show damage types that no unit possesses.

If that's not it, please tell me exactly what you do to check that it's working (and conclude that it doesn't).
First I spawn a skeleton. I defined the code of the [resistance_defaults] such that this Skeleton (or, Revenant, Draug, Banebow, Bone Shooter, Skeleton Archer, any thing with undeadfoot movetype) will have electric -30%
[section]
Screenshot 2020-11-23 051423.png
[/section]
The screenshot shots that the new resistance type was not added.
Further test:
If the Skyrunner hits the Skeleton with her ranged attack, she would get a 1.3 dmg multiplier.
[section]
Screenshot 2020-11-23 051532.png
[/section]
However, she receives no damage bonus and neither is it shown on the damage calc window.

Hence, I conclude. It does not work.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Celtic_Minstrel
Developer
Posts: 2194
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [resistance_defaults] doesn't work

Post by Celtic_Minstrel »

So, I assume it also doesn't show in the in-game help?
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2356
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [resistance_defaults] doesn't work

Post by Lord-Knightmare »

So, I assume it also doesn't show in the in-game help?
Yes.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Celtic_Minstrel
Developer
Posts: 2194
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [resistance_defaults] doesn't work

Post by Celtic_Minstrel »

I've confirmed that the following code which works on 1.14.4 does not work on 1.15 master:

Code: Select all

[resistance_defaults]
	id=sonic
	default="(impact)"
[/resistance_defaults]
This is in my unreleased WIP campaign which adds a sonic attack to some units. Sonic resistance shows correctly for those that specify it in the movetype, but for mainline units it does not show up at all.

EDIT: I opened issue #5308 to track this.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2356
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [resistance_defaults] doesn't work

Post by Lord-Knightmare »

Ah, a bug. Suspected it. This is the second "regression" bug I have encountered for the month.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Post Reply