Minimum value for [attacks] and [damage]

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
Spannerbag
Posts: 876
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Minimum value for [attacks] and [damage]

Post by Spannerbag »

Hi,
Not sure if I've missed something obvious hence this post.

I want to nerf an opponent's [attacks] and [damage] significantly but not below 1 in either case (v1.18.5).
Using values greater than opponents strikes/damage via both sub and [divide] on 1.18 result in 0.

Examples;

1: normal combat
normal.png
2: [damage] (damage mod shown in special name)
damageall.png
3: [attacks] (strikes mod shown in special name)
strikes_all.png

Is there any way I can specify a minum value (=1) for both strikes and damage?
I had hoped to use something like value="max(1,round(???/divide_value))" or value="max(1,(??? - sub_value))"but don't know how to access the appropriate number of stikes/damage in a straightforward manner as the nerf applies for both melee and ranged (and even if I separate the specials by range some units have multiple ranged and/or melee attacks anyway so I still have to select the correct value from 2+ options).

Hope this all makes sense.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Minimum value for [attacks] and [damage]

Post by Ravana »

[filter_base_value]
User avatar
Spannerbag
Posts: 876
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Minimum value for [attacks] and [damage]

Post by Spannerbag »

Ravana wrote: September 13th, 2025, 3:52 pm [filter_base_value]
Brilliant!
Got everything working as I wanted. :D

Thanks ever so much for your help, much appreciated as always.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
newfrenchy83
Code Contributor
Posts: 214
Joined: October 6th, 2017, 12:57 pm

Re: Minimum value for [attacks] and [damage]

Post by newfrenchy83 »

after wesnoth 1.19.2, you could use min_value=1 for prevent final value to be lower what 1
User avatar
Spannerbag
Posts: 876
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Minimum value for [attacks] and [damage]

Post by Spannerbag »

newfrenchy83 wrote: October 5th, 2025, 9:45 am after wesnoth 1.19.2, you could use min_value=1...
Noted, thanks! :thumbsup:

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
Post Reply