WML Request

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
allanate
Posts: 16
Joined: November 16th, 2010, 3:31 pm

WML Request

Post by allanate »

Can someone make me one or more of these macro ideas.? Im almost done with my giant campain and these are all i need to finish. Thanks in advance

(listed from greatest to least priority)

1. In Scenario event were if your unit kills an enemy, some exp goes to your leader

2. Weapon special that has a 50% chance of an instant kill

3. Weapon special or or ability that makes your unit heal 1 hp instantly once hit.
User avatar
alexanderthegre
Posts: 193
Joined: December 8th, 2011, 3:23 am
Location: nowhere

Re: WML Request

Post by alexanderthegre »

I'm a little rusty, and #1 is over my head, but here are 2 and 3 (untested, might not work):

Code: Select all

#define WEAPON_SPECIAL_DECAPITATE
[dummy]
 id=decapitation
 name= _ "decapitation"
 description= _ "Decapitation:
Whenever this unit attacks, there is a 50% chance of decapitation."
[/dummy]
#enddef

[event]
 name=attacker hits
 [filter_weapon]
  special=decapitation
 [/filter_weapon]
 [kill]
  x,y=$x2,$y2
 [/kill]
[/event]

Code: Select all

#define WEAPON_SPECIAL_DRAINS_1
[dummy]
 id=drains_1
 name= _ "Drains 1"
 description= _ "Drains 1:
Whenever this unit hits, it gains 1 hitpoint."
[/dummy]
#enddef

[event]
 name=attack hits
 [filter_weapon]
  special=drains_1
 [/filter_weapon]
 [heal_unit]
  [filter]
   x,y=$x1, $y1
  [/filter]
  amount=1
  violate_maximum=yes
 [/heal_unit]
[/event]
Rebel_Angel
Posts: 7
Joined: July 7th, 2012, 9:03 am
Location: Dancing on the head of a pin

Re: WML Request

Post by Rebel_Angel »

@Alexanderthegre - if I'm not mistaken, your Decapitation ability will work every time (you haven't accounted for the 50% chance of failure)

I haven't tested these, and as I've been away from WML for quite some time, I may have forgotten things or made mistakes. But try these, if nobody more reliable steps forward!

1.

Code: Select all

[event]
name=die
first_time_only=no
    [filter_second]
        ability=strengthen_leader
    [/filter_second]
        [store_unit]
            [filter]
                side=$second_unit.side
                canrecruit=yes
            [/filter]
            variable=player_leader
        [/store_unit]
            [set_variable]
                name=player_leader.hitpoints
                add=1
            [/set_variable]
                [unstore_unit]
                    variable=player_leader
                    {COLOR_HEAL}
                    text= _ "+1 Experience"
                    find_vacant=no
                [/unstore_unit]
        {CLEAR_VARIABLE player_leader}
[/event]
2.

Code: Select all

#define WEAPON_SPECIAL_LETHAL
# wmllint: unbalanced-on
[dummy]
id=lethal
name= _ "lethal"
description= _ "Lethal:
If this attack hits, it has a 50% chance to instantly kill the enemy."
[/dummy]
[specials]
[/specials]
[event]
name=attacker_hits
first_time_only=no
    [filter]
        [filter_attack]
            special=lethal
        [/filter_attack]
    [/filter]
        [set_variable]
            name=coin_flip
            random=1,2
        [/set_variable]
            [if]
                [variable]
                    name=coin_flip
                    equals=2
                [/variable]
                    [then]
                        [kill]
                            [filter]
                                x,y=$x2,$y2
                            [/filter]
                        [/kill]
                    [/then]
            [/if]
{CLEAR_VARIABLE coin_flip}
[/event]
[+specials]
[/specials]
#enddef
# wmllint: unbalanced-off
3. Your wording is a little unclear - do you mean that the unit is healed when it hits an enemy (like a version of Drain), or that after the unit itself is hit, it regains 1HP?

EDIT: I realized that I had misread request #1. Originally I wrote it as an ability possessed by a specific unit. I've now corrected this, and it should work (I think!) as an [event] in a scenario, regardless of what units are involved.
Last edited by Rebel_Angel on July 11th, 2012, 12:38 am, edited 1 time in total.
Merry meet, and merry part, and merry meet again.
allanate
Posts: 16
Joined: November 16th, 2010, 3:31 pm

Re: WML Request

Post by allanate »

kinda like once you take damage you heal after the hit.
Rebel_Angel
Posts: 7
Joined: July 7th, 2012, 9:03 am
Location: Dancing on the head of a pin

Re: WML Request

Post by Rebel_Angel »

Once again, I haven't tested it:-

Code: Select all

# wmllint: unbalanced-on
#define ABILITY_HEALS_WHEN_HIT
[dummy]
    id=heals_when_hit
    name= _ "heals when hit"
    female_name= _ "female^heals when hit"
    description=_ "Heals when hit:
Whenever this unit is hit by an enemy, it immediately recovers 1HP"
[/dummy]
    [abilities]
    [/abilities]
        [event]
            name=attacker_hits,defender_hits
            first_time_only=no
                [filter_second]
                    ability=heals_when_hit
                [/filter_second]
                    [unstore_unit]
                        variable=second_unit
                        {COLOR_HEAL}
                        text= _ "+1 HP"
                        find_vacant=no
                   [/unstore_unit]
                       [heal_unit]
                           [filter]
                               x,y=$x2, $y2
                           [/filter]
                               amount=1
                       [/heal_unit]
[/event]
[+abilities]
[/abilities]
#enddef
# wmllint: unbalanced-off
Merry meet, and merry part, and merry meet again.
Post Reply