[illuminates] ability question

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.
kurt751
Posts: 398
Joined: June 4th, 2016, 11:17 pm

[illuminates] ability question

Post by kurt751 »

I've got a strange issue with a cumulative [illuminates] ability: It doesn't accumulate in the dark...

Imagine a unit which illuminates (mage of light), standing besides another which has a special cumulative illumination*. When outside (daylight), lawful units affected by both indeed display the cumulative illumination. When in the dark, they don't, they just display "+0%". How comes?

* The presence of angels and such should affect adjacent units no matter the daylight. I've thus created a special ability like this:

Code: Select all

#define ABILITY_HOLY_AURA
    # Variation of the Illuminates ability
    [illuminates]
        id=holyaura
        value=25
        max_value=50
        cumulative=yes
        name= _ "holy aura"
        description= _ "This holy unit illuminates the surrounding area, making lawful units fight much better, and chaotic units fight much worse.

Note this is cumulative."
    [/illuminates]
#enddef
As I said, it works during daylight (giving "+40%"), but not during night (or underground)("+0%"): The "cumulative=yes" part is lost. :hmm:
Where did I go wrong?
User avatar
Ravana
Forum Moderator
Posts: 3562
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [illuminates] ability question

Post by Ravana »

You implemented that 2 abilities ABILITY_HOLY_AURA that target same location are cumulative. You probably didnt give mage of light this ability.
kurt751
Posts: 398
Joined: June 4th, 2016, 11:17 pm

Re: [illuminates] ability question

Post by kurt751 »

Ravana wrote: July 15th, 2026, 12:40 pm You probably didnt give mage of light this ability.
No, indeed: The "mage of light" unit has his standard stock ability, but is standing adjacent to an "angel" unit with the "Holy Aura" ability.
Units standing where both the mage of light and the angel affect them, display the accumulation during daylight, but not during night.
User avatar
Ravana
Forum Moderator
Posts: 3562
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [illuminates] ability question

Post by Ravana »

Mage of light does not have ability with id=holyaura.

id: this ability will not be cumulative with other abilities using this id. Must be present if cumulative is anything other than 'yes'.
cumulative: if set to 'yes', the [leadership] value will be added to another [leadership] value= same if have same id=, for other abilities, the highest value between value= or base_value will be chosen.

Though cumulative is quite rarely used so it is possible it does not behave exactly as I would expect. Documentation does not make clear what it changes for non-leadership.
kurt751
Posts: 398
Joined: June 4th, 2016, 11:17 pm

Re: [illuminates] ability question

Post by kurt751 »

Ravana wrote: July 15th, 2026, 9:53 pm Mage of light does not have ability with id=holyaura.
I never said that.

Let's put things back in focus please:

• My cumulative illumination works in daylight (result = daylight bonus + mage bonus + angel bonus).
• My cumulative illumination does not work during night (result = just removes the -15% penalty, like a normal illumination).

My actual question is: Why is that difference?
Cumulative illumination should either not work at all, or work all the time.

There seems to be some quirk in the bonus calculation: It seems that if it starts from a negative value, it can't go over 0. :hmm:
But if it starts from a > 0 value, it works as expected.
User avatar
Spannerbag
Posts: 951
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [illuminates] ability question

Post by Spannerbag »

Eh, not tested any of this, just a random thought that might help clarify?

Presumably what you are seeing with regards to a lawful unit adjacent to both a Mage of Light (MoL) and Angel is this:
  1. Daytime (morning/Afternoon/Midday): +50%
    Lawful unit gets best of (not sum of because they are not cumulative abilties) MoL/Angel (i.e. +25%) + another 25% due to daylight.
  2. Night (First Watch/Second Watch/Midnight): +0%.
    Again lawful gets +25% from MoL/Angel but -25% due to darkness so 0% overall.
Note that at night, lawfuls adjacent to a MoL are at +0%.
LB.jpg
LB.jpg (47.05 KiB) Viewed 194 times
Hope this helps.

Disclaimer: all results generated by Spannerbag may contain inaccuracies, hallucinations and/or state the bleedin' obvious. :whistle:

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...
kurt751
Posts: 398
Joined: June 4th, 2016, 11:17 pm

Re: [illuminates] ability question

Post by kurt751 »

Spannerbag wrote: July 16th, 2026, 12:11 pm Daytime (morning/Afternoon/Midday): +50%
Lawful unit gets best of (not sum of because they are not cumulative abilties) MoL/Angel (i.e. +25%) + another 25% due to daylight.
What do you mean by "best of"? Best of what?

If I understand you right, you're telling me that those +50% I see are simply daylight + angel, no influence from the MoL?
That does make sense.

So cumulative=yes only works with the environment? :(
That's harsh.

Is there maybe another way to do it?
I want units near an angel to get an additional bonus (the 50 cap was so if there are 2 or more angels nearby the bonus won't rise into silly numbers).
User avatar
Ravana
Forum Moderator
Posts: 3562
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [illuminates] ability question

Post by Ravana »

I already posted what cumulative is documented to do.
User avatar
Celtic_Minstrel
Developer
Posts: 2476
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [illuminates] ability question

Post by Celtic_Minstrel »

kurt751 wrote: July 16th, 2026, 4:30 pm So cumulative=yes only works with the environment?
No. Cumulative basically means "cumulative with itself". If you put two angels next to your guy during the day, I bet you'll see +75%.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Spannerbag
Posts: 951
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [illuminates] ability question

Post by Spannerbag »

Heh, was typing this when Celtic_Minstrel posted so apologies for repeating some info.
I understand the wiki can be a bit overwhelming when you're learning.

Under Common keys and tags for every ability:
id: this ability will not be cumulative with other abilities using this id. Must be present if cumulative is anything other than 'yes'.
Further down under Common keys and tags for abilities with a value
cumulative: if set to 'yes', the [leadership] value will be added to another [leadership] value= same if have same id=, for other abilities, the highest value between value= or base_value will be chosen.
Mainline Mage of Light (MoL) has {ABILITY_ILLUMINATES}, defined in macros→abilities.cfg:

Code: Select all

#define ABILITY_ILLUMINATES
    # Canned definition of the Illuminates ability to be included in an
    # [abilities] clause.
#arg HALO
""#endarg
    [illuminates]
        id=illumination
        value=25
        max_value=25
        cumulative=no
        name= _ "illuminates"
        female_name= _ "female^illuminates"
        description= _ "This unit illuminates the surrounding area, making lawful units fight better, and chaotic units fight worse.

Any units adjacent to this unit will fight as if it were dusk when it is night, and as if it were day when it is dusk."
        special_note={INTERNAL:SPECIAL_NOTES_ILLUMINATES}
        affect_self=yes
        halo_image={HALO}
    [/illuminates]
#enddef
The key of interest here is cumulative=no meaning that regardless of how many MoLs a unit may be adjacent to it only ever receives a ±25% once.
This, I presume, is for balance otherwise units could accumulate multiple ±25%s making their damage output either insanely high or negligible (=1 I would imagine is the minimum).

In addition, your {ABILITY_HOLY_AURA} has id=holyaura:

Code: Select all

#define ABILITY_HOLY_AURA
    # Variation of the Illuminates ability
    [illuminates]
        id=holyaura
        value=25
        max_value=50
        cumulative=yes
...
So will only be cumulative with other units with this ability (id=holyaura) so cannot be cumulative with MoL (id=illumination).

If I might humbly offer a suggestion: it might be a useful exercise to experiment with having 2+ MoL and Angels on a map and seeing how lawful and chaotic units bonuses change depending on time of day and how many MoLs/Angels they are adjacent to?
This would give you a feel of how the bonuses scale in gameplay.

Depending upon what, exactly, you want your Angel's ability to achieve there may be other ways to do what you want?
If you want a sort of "MoL booster unit" it should be possible to create an [illuminates] ability that acts like MoL (i.e. +25%) when not adjacent to a MoL but increases this bonus to, say, +75 or +100% or whatever when adjacent to MoL(s) or other Angel(s).
Or, you could customise MoLs for your campaign (it would be possible to arrange this in several ways, most of which could be made transparent to the player so that the player believes they are recruiting normal Mage line units).

Personally I would use cumulative=yes with caution because it could easily unbalance your campaign without some limit on this ability (e.g. number of Angels/MoLs etc.).

Anyway, hope my witterings help!

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...
kurt751
Posts: 398
Joined: June 4th, 2016, 11:17 pm

Re: [illuminates] ability question

Post by kurt751 »

Celtic_Minstrel wrote: July 17th, 2026, 12:44 pm No. Cumulative basically means "cumulative with itself". If you put two angels next to your guy during the day, I bet you'll see +75%.
I see, thanks. Well, I was assuming the "cumulative" part was on the actual "illuminate" function. Admit it could had been... :)
kurt751
Posts: 398
Joined: June 4th, 2016, 11:17 pm

Re: [illuminates] ability question

Post by kurt751 »

Spannerbag wrote: July 17th, 2026, 12:45 pm The key of interest here is cumulative=no meaning that regardless of how many MoLs a unit may be adjacent to it only ever receives a ±25% once.
Indeed. What I am trying to achieve, is to have a unit type which adds to other illuminating units (MoLs or other). And this especially in the dark, because the whole point of this exercise was improving fighting underground or in strange places (I have lots of them!): I needed a unit which adds a positive bonus (instead of just removing the penalty) to lawful units when the time zone's "lawful_bonus" is 0 (or even negative).
Spannerbag wrote: July 17th, 2026, 12:45 pm This, I presume, is for balance otherwise units could accumulate multiple ±25%s making their damage output either insanely high or negligible
Indeed, which is why I capped it to 50.
Spannerbag wrote: July 17th, 2026, 12:45 pm it might be a useful exercise to experiment with having 2+ MoL and Angels on a map and seeing how lawful and chaotic units bonuses change depending on time of day and how many MoLs/Angels they are adjacent to?
This would give you a feel of how the bonuses scale in gameplay.
As I said it's capped so you could surround the unit with angels, it wouldn't get more than +50%, I've tested.
Spannerbag wrote: July 17th, 2026, 12:45 pm Depending upon what, exactly, you want your Angel's ability to achieve there may be other ways to do what you want?
As I said just above what I want to achieve is to give lawful units a boost underground and in strange places where the base "lawful_bonus" value is negative.

Currently I'm experimenting with a variation like:

Code: Select all

#define ABILITY_HOLY_AURA
   [illuminates]
        id=holyaura
        value=35
        max_value=50
        cumulative=yes
        name= _ "holy aura"
        description= _ "This unit illuminates the surrounding area, making lawful units fight better, and chaotic units fight worse."
    [/illuminates]
#enddef
It seems to do what I wanted, meaning that underground it gives adjacent lawful units a +10 bonus (no MoL required). It might be a little weak when the base "lawful_bonus" is -25, but I'll need to test it before rising it further. I might need to lower the max_value to prevent it from getting ridiculous in daylight. :hmm:

Spannerbag wrote: July 17th, 2026, 12:45 pm Or, you could customise MoLs for your campaign
No, I won't touch stock units. When I need a modified version, I create a new unit and use that instead (like for instance boars, of which I created a much nastier version. The ones I've seen in real life were definitely something to respect... :)).
Spannerbag wrote: July 17th, 2026, 12:45 pm Personally I would use cumulative=yes with caution because it could easily unbalance your campaign without some limit on this ability (e.g. number of Angels/MoLs etc.).
It's the first thing I thought about and as I said I capped it by max_value=50, so no problem with that.
Thanks!
User avatar
Celtic_Minstrel
Developer
Posts: 2476
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [illuminates] ability question

Post by Celtic_Minstrel »

kurt751 wrote: July 17th, 2026, 3:46 pm
Spannerbag wrote: July 17th, 2026, 12:45 pm Or, you could customise MoLs for your campaign
No, I won't touch stock units. When I need a modified version, I create a new unit and use that instead (like for instance boars, of which I created a much nastier version. The ones I've seen in real life were definitely something to respect... :)).
Just for the record, when someone talks about customizing a core unit, this is pretty much exactly what they mean – it's not a suggestion to edit core files.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
kurt751
Posts: 398
Joined: June 4th, 2016, 11:17 pm

Re: [illuminates] ability question

Post by kurt751 »

Celtic_Minstrel wrote: July 17th, 2026, 5:32 pm Just for the record, when someone talks about customizing a core unit, this is pretty much exactly what they mean – it's not a suggestion to edit core files.
My bad. :oops:
User avatar
Spannerbag
Posts: 951
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [illuminates] ability question

Post by Spannerbag »

kurt751 wrote: July 17th, 2026, 3:46 pm ...Indeed, which is why I capped it to 50.
...
As I said it's capped so you could surround the unit with angels, it wouldn't get more than +50%, I've tested.
...
It's the first thing I thought about and as I said I capped it by max_value=50, so no problem with that...
OK, got that. :)

kurt751 wrote: July 17th, 2026, 3:46 pm Indeed. What I am trying to achieve, is to have a unit type which adds to other illuminating units (MoLs or other). And this especially in the dark, because the whole point of this exercise was improving fighting underground or in strange places (I have lots of them!): I needed a unit which adds a positive bonus (instead of just removing the penalty) to lawful units when the time zone's "lawful_bonus" is 0 (or even negative).
What I was thinking of was something like the code below.
I Have not tested this WML, it's only intended to demonstrate the concept.

Code: Select all

#define ABILITY_HOLY_AURA
   [illuminates]
        id=holyaura
        value=35
        max_value=50
        cumulative=yes
        name= _ "holy aura"
        description= _ "This unit illuminates the surrounding area, making lawful units fight better, and chaotic units fight worse."
        [filter_adjacent]
            ability_id_active=illumination,holyaura
            is_enemy=no
            count=0
        [/filter_adjacent]
    [/illuminates]
    [illuminates]
        id=holyaura_hidden
        value=50
        max_value=50
        cumulative=yes
        [filter_adjacent]
            ability_id_active=illumination,holyaura
            is_enemy=no
            count=1-6
        [/filter_adjacent]
    [/illuminates]
#enddef

Also, it might be possible to set value= higher than max_value= (not tried, don't know).
Even if that's not possible you can test for the time of day via [filter_location] and have multiple hidden versions that activate only under certain times of day - tho' I'm sure people cleverer than me will suggest more elegant solutions!

Hope this helps.

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