[illuminate], negative values, and a workaround.

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
Jami
Posts: 149
Joined: March 15th, 2007, 4:00 am

[illuminate], negative values, and a workaround.

Post by Jami »

I've been working on a darkens/deluminates ability for a faction i've been toying around with. However, recently i've run into a problem with the abilities of one of my units.

Apparently the [Illuminates] tag doesn't allow for specifying how low (negative, chaotic) a value can go globally, like it does for positive values (the actual illuminates ability). Meaning that an ability I've been working on doesn't work as intended

I've been trying to make a workaround using [if][not][then] tags and a location filter, however wesnoth refuses to recognize the location filter on time_of_day

Here is my current code.

Code: Select all

   1.
      #define ABILITY_DELUMINATES
   2.
       
   3.
          # definition of the Deluminates ability    
   4.
      # [abilities] clause.
   5.
       
   6.
          [illuminates]
   7.
       
   8.
              [if]
   9.
                      [have_location]
  10.
                              time_of_day=lawful
  11.
                      [/have_location]
  12.
              [then]
  13.
                      value=-25
  14.
              [/then]
  15.
              [else]
  16.
                      value=0
  17.
       
  18.
                     
  19.
              [/else]
  20.
              [/if]
  21.
       
  22.
              id=delumination
  23.
       
  24.
       
  25.
              cumulative=no
  26.
       
  27.
              name= _ "deluminates"
  28.
       
  29.
              description= _ "Deluminates:
  30.
      This unit
  31.
       
  32.
      dluminates the surrounding area, making chaotic
  33.
       
  34.
      units fight better, and lawful units fight worse.
  35.
       
  36.
      Any units adjacent to this unit will fight as if it
  37.
       
  38.
      were dawn when it is day, and as if it were night
  39.
       
  40.
      when it is dawn."
  41.
              affect_self=yes
  42.
          [/illuminates]
  43.
      #enddef
Obviously this code would only work during day (I'm planning on adding in a [not] tag if I can get it to work), however right now it works all of the time.

Any thoughts?
~Jami
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: [illuminate], negative values, and a workaround.

Post by AI »

You're not the first to think this one up. :P

Code: Select all

#define ABILITY_DARKENS
    [illuminates]
        id=darkens
# The next filter is a workaround thought by zookeeper as a substitute for the non working min_value=-25 limit, making this ability not give double TOD bonus/penalty at night. When/if  a support for the min_value key inside illuminates is added, the filter will be redundant and should be removed
        [filter]
            [not]
                [filter_location]
                   time_of_day=chaotic
                [/filter_location]
            [/not]
        [/filter]
        value=-25
        min_value=-25
        max_value=0
        cumulative=no
        name= _ "darkens"
        description= _ "Darkens:
This unit covers the surrounding area in a shroud of darkness, making chaotic units fight better, and lawful units fight worse.

Any units adjacent to this unit will fight as if it were night when it is dusk, and as if it were dusk when it is day."
        affect_self=yes
    [/illuminates]
#enddef
User avatar
governor
Posts: 267
Joined: December 8th, 2006, 12:32 am

Re: [illuminate], negative values, and a workaround.

Post by governor »

Similar to the above:

Code: Select all

[illuminates]
  id=delumination
  [filter_adjacent_location]
    time_of_day = lawful
  [/filter_adjacent_location]
  
  cumulative=no
  name= _ "deluminates"
  value=-25
  max_value=0
  affect_enemies=yes
  affect_allies=no
  affect_self=no
  description= _ "Deluminates:
...
[/illuminates]
Note: [if] tag and children are not valid inside [illumiates] therefore we use [filter_xxxx]
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: [illuminate], negative values, and a workaround.

Post by AI »

The main difference between the two is whether it works at dawn/dusk, which I think it should.
User avatar
Jami
Posts: 149
Joined: March 15th, 2007, 4:00 am

Re: [illuminate], negative values, and a workaround.

Post by Jami »

Neither implementation is causing the ability to respect TOD in any way. :/
~Jami
User avatar
governor
Posts: 267
Joined: December 8th, 2006, 12:32 am

Re: [illuminate], negative values, and a workaround.

Post by governor »

What about this for the filter:

Code: Select all

[filter_self]
  [filter_location]
     time_of_day = lawful
  [/filter_location]
[/filter_self]
User avatar
Jami
Posts: 149
Joined: March 15th, 2007, 4:00 am

Re: [illuminate], negative values, and a workaround.

Post by Jami »

That did it.

I suppose what we had been trying before didn't tell the game what location to filter, so it was just ignoring the filter, or something like that.

Thanks governor ^^v
~Jami
User avatar
Espreon
Inactive Developer
Posts: 630
Joined: June 9th, 2007, 4:08 am

Re: [illuminate], negative values, and a workaround.

Post by Espreon »

Actually Shadow Master created an ability called "obscure" which is the opposite of illuminate. It is currently used in his campaign, IFtU, and will be implemented in mine.
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: [illuminate], negative values, and a workaround.

Post by Iris »

Espreon wrote:Actually Shadow Master created an ability called "obscure" which is the opposite of illuminate. It is currently used in his campaign, IFtU, and will be implemented in mine.
Does it work? Sorry, I haven't really tested it in-depth to make sure it does. :D
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
Vendanna
Posts: 626
Joined: September 16th, 2006, 10:07 pm
Location: Spain

Re: [illuminate], negative values, and a workaround.

Post by Vendanna »

Shadow Master wrote:Does it work? Sorry, I haven't really tested it in-depth to make sure it does. :D
For my part I'm not sure, I always paired Our beloved lich with the Shide having the opposite effect, and don't know what happens if both habilities clash :p

However, I think that obscures also appears on Ken oh abilities era, so you can check it too for reassure it works. :eng:
"Mysteries are revealed in the light of reason."
User avatar
Espreon
Inactive Developer
Posts: 630
Joined: June 9th, 2007, 4:08 am

Re: [illuminate], negative values, and a workaround.

Post by Espreon »

Shadow Master wrote:
Espreon wrote:Actually Shadow Master created an ability called "obscure" which is the opposite of illuminate. It is currently used in his campaign, IFtU, and will be implemented in mine.
Does it work? Sorry, I haven't really tested it in-depth to make sure it does. :D
Ummm, yeah it does! It works beautifully on my beloved Death Knights/Barons and my other undead minions.
Post Reply