[resistance_defaults] doesn't work
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.
- Lord-Knightmare
- Discord Moderator
- Posts: 2359
- 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
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:
If defined for custom movement types, the desired resistance values are assigned flawlessly. However, for the core movement types using
Any suggestions for rectification or is this tag still in experimental phase?
Quoted from the WML reference documentation:
This is the code I added to the[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.
_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]
[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
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: [resistance_defaults] doesn't work
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
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- Lord-Knightmare
- Discord Moderator
- Posts: 2359
- 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
I have updated the code as follows:Are you using [resistance_default] in the proper context? It's only valid inside the [units] tag, while [language] is toplevel.
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
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [resistance_defaults] doesn't work
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.- Lord-Knightmare
- Discord Moderator
- Posts: 2359
- 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
I have updated the code again and took the code out theComment 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.
#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]
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [resistance_defaults] doesn't work
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).
If that's not it, please tell me exactly what you do to check that it's working (and conclude that it doesn't).
- Lord-Knightmare
- Discord Moderator
- Posts: 2359
- 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
[section] [/section]Just checking, but do you actually have units with an electric damage type? I
First I spawn a skeleton. I defined the code of theIf 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).
[resistance_defaults]
such that this Skeleton (or, Revenant, Draug, Banebow, Bone Shooter, Skeleton Archer, any thing with undeadfoot movetype) will have electric -30%
[section] [/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] [/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
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [resistance_defaults] doesn't work
So, I assume it also doesn't show in the in-game help?
- Lord-Knightmare
- Discord Moderator
- Posts: 2359
- 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
Yes.So, I assume it also doesn't show in the in-game help?
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [resistance_defaults] doesn't work
I've confirmed that the following code which works on 1.14.4 does not work on 1.15 master:
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.
Code: Select all
[resistance_defaults]
id=sonic
default="(impact)"
[/resistance_defaults]
EDIT: I opened issue #5308 to track this.
- Lord-Knightmare
- Discord Moderator
- Posts: 2359
- 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
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
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium