Weapon special "Dissolve"

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
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Weapon special "Dissolve"

Post by Lizard »

I want one of my Free Saurian Units to have the a Weapon special called Dissolve. Whenever he kills a unit with dissolve all adjacent allies(of the Saurian) are healed by a Value. But the problem is, that I don't know how to do it. This is what i have so far:

Code: Select all

#define WEAPON_SPECIAL_DISSOLVE UNIT_TYPE HEAL_VALUE
	[berserk]
		name=_ "dissolve"
		name_inactive=_ "dissolve"
		description=_ "This Weapon special does s.th."
		description_inactive=_ "This Weapon special does s.th."
		value=1
	[/berserk]
[/specials]

	[event]
	
	[/event]

[+specials]

#enddef
If I make a die event I can't filter for the attack used, but I can't think of a event making this possible.
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Re: Weapon special "Dissolve"

Post by Noyga »

Try something like this (1.4.x WML, untested) :

Code: Select all

#define WEAPON_SPECIAL_DISSOLVE RACE HEAL_VALUE
   [dummy]
      id=dissolve
      name=_ "dissolve"
      description=_ "This Weapon special does s.th."
   [/dummy]
   [/abilities]
   [event]
      name=die
      first_time_only=no
# don't "disolve" if we kill a not living unit
     [filter]
        [not]
            [wml_filter]
                [status]
                    not_living="yes"
                [/status]
            [/wml_filter]
        [/not]
      [/filter]
      [filter_second]
         ability=dissolve
      [/filter_second]
      [store_unit]
          variable=neighbour_ally
          kill=no
          [filter]
             [filter_adjacent]
                 x,y=$x2,$y2
                 is_enemy=no
             [/filter_adjacent]
             race={RACE}
          [/filter]
      [/store_unit]
# this is for proper internationalisation (never call a macro inside a translatable string !)
      [set_variable]
          name=disolve_amount
          value={HEAL_VALUE}
      [/set_variable]
# send the heal message(s)
      [unstore_unit]
         {COLOR_HEAL}
         text= _ "+$disolve_amount HP"
         find_vacant=no
         variable=neighbour_ally
      [/unstore_unit]
      [clear_variable]
          name=neighbour_ally
      [/clear_variable]
      [clear_variable]
          name=disolve_amount
      [/clear_variable]
# heal
      [object]
        silent=yes
        duration=forever
        [filter]
              [filter_adjacent]
                 x,y=$x2,$y2
                 is_enemy=no
             [/filter_adjacent]
             race={RACE}
        [/filter]
        [effect]
            apply_to=hitpoints
            increase={HEAL_VALUE}
            violate_maximum=no
        [/effect]
      [/object]
    [/event]
    [+abilities]
#enddef
"Ooh, man, my mage had a 30% chance to miss, but he still managed to hit! Awesome!" ;) -- xtifr
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Re: Weapon special "Dissolve"

Post by Noyga »

Opps, i made an ability, not a weapon special :oops:

For the weapon special version, replace [/abilities] and [+abilities] with [/specials] and [+specials] and replace :

Code: Select all

      [filter_second]
         ability=dissolve
      [/filter_second]
by

Code: Select all

     [special_filter_second]
         special=dissolve
      [/special_filter_second]
"Ooh, man, my mage had a 30% chance to miss, but he still managed to hit! Awesome!" ;) -- xtifr
User avatar
Lizard
Posts: 355
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: Weapon special "Dissolve"

Post by Lizard »

This is what I currently have, but it does nothing :(

Code: Select all

#define WEAPON_SPECIAL_DISSOLVE RACE HEAL_VALUE
   [dummy]
      id=dissolve
      name=_ "dissolve"
      description=_ "This Weapon special does s.th."
   [/dummy]
   [/specials]
   [event]
      name=die
      first_time_only=no
# don't "disolve" if we kill a not living unit
     [filter]
        [not]
            [wml_filter]
                [status]
                    not_living="yes"
                [/status]
            [/wml_filter]
        [/not]
      [/filter]
     [special_filter_second]
         special=dissolve
      [/special_filter_second]
      [store_unit]
          variable=neighbour_ally
          kill=no
          [filter]
             [filter_adjacent]
                 x,y=$x2,$y2
                 is_enemy=no
             [/filter_adjacent]
             race={RACE}
          [/filter]
      [/store_unit]
# this is for proper internationalisation (never call a macro inside a translatable string !)
      [set_variable]
          name=disolve_amount
          value={HEAL_VALUE}
      [/set_variable]
# send the heal message(s)
      [unstore_unit]
         {COLOR_HEAL}
         text= _ "+$disolve_amount HP"
         find_vacant=no
         variable=neighbour_ally
      [/unstore_unit]
      [clear_variable]
          name=neighbour_ally
      [/clear_variable]
      [clear_variable]
          name=disolve_amount
      [/clear_variable]
# heal
      [object]
        silent=yes
        duration=forever
        [filter]
              [filter_adjacent]
                 x,y=$x2,$y2
                 is_enemy=no
             [/filter_adjacent]
             race={RACE}
        [/filter]
        [effect]
            apply_to=hitpoints
            increase={HEAL_VALUE}
            violate_maximum=no
        [/effect]
      [/object]
    [/event]
    [+specials]
#enddef

Code: Select all

	[attack]
		name=ice_ball
		description= _"Ice Ball"
		icon=attacks/iceball.png
		type=cold
		range=ranged
		[specials]
			{WEAPON_SPECIAL_MAGICAL}
			{WEAPON_SPECIAL_DISSOLVE lizard 8}
		[/specials]
		damage=8
		number=3
	[/attack]
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa
User avatar
doofus-01
Art Director
Posts: 4128
Joined: January 6th, 2008, 9:27 pm
Location: USA

Re: Weapon special "Dissolve"

Post by doofus-01 »

The wiki says only one [specials] entry is supported, try removing the "{WEAPON_SPECIAL_MAGICAL}".

EDIT: Never mind. As megane says, the wiki was wrong. It just got fixed about the time I posted that.
Last edited by doofus-01 on April 20th, 2008, 3:37 pm, edited 1 time in total.
megane
Art Contributor
Posts: 410
Joined: October 30th, 2006, 4:55 am
Location: The Big Ö (a.k.a. Austria)

Re: Weapon special "Dissolve"

Post by megane »

doofus-01 wrote:The wiki says only one [specials] entry is supported, try removing the "{WEAPON_SPECIAL_MAGICAL}".
Well, the wiki is incorrect on that point. I've personally made units whose attacks have multiple specials.
that little girl's parents were attacked by ninjas - generic npc
hee hee! - little girl
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Re: Weapon special "Dissolve"

Post by Noyga »

Lizard wrote:This is what I currently have, but it does nothing :(
It might be an issue with special filtering. Does the ability version works ?
Btw since i didn't even test it there might be some bugs in my code too.
"Ooh, man, my mage had a 30% chance to miss, but he still managed to hit! Awesome!" ;) -- xtifr
Post Reply