Filter weapon special in attack_anim

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
white_haired_uncle
Posts: 1226
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Filter weapon special in attack_anim

Post by white_haired_uncle »

I'm creating a suicide bomber. When it attacks on offense it explodes, killing itself and damaging all adjacent units for the attacker's hitpoints. I have all this working, but I can't get the sounds right. I want it to use explosion.ogg when the special is active, and lightning.ogg when it is not (on defense).

Bonus question: I'm looking for "explosion-miss.ogg", the sound of an explosive attack failing to ignite. It might be called fizzle.ogg. Anyone have anything FOSS?

Here is what I tried. I made up the [filter_attack] on special_id stuff by piecing together examples from other areas, I have no reason to believe it is correct, but ti was worth a shot.

Code: Select all

    [attack]
        name=shock
        description= _"shock"
        icon=attacks/lightning.png
        type=lightning
        range=melee
        damage=20
        number=1
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
            {WEAPON_SPECIAL_EXPLOSIVE_DETONATION}
        [/specials]
    [/attack]
where

Code: Select all

#define WEAPON_SPECIAL_EXPLOSIVE_DETONATION
    [damage]
        id=explosive detonation
        name=_"explosive detonation"
        description=_"When used on offense, this attack causes the attacker to explode, killing it instantly.  All adjacent units will take damage of the weapon's type equal to the attacker's hitpoints."
        active_on=offense
        multiply=0
    [/damage]
#enddef
and

Code: Select all

    [attack_anim]
        [filter_attack]
            special_id=explosive detonate
        [/filter_attack]
        [missile_frame]
            begin=-200
            end=0
            image="projectiles/shockmissile-n.png"
            image_diagonal="projectiles/shockmissile-ne.png"
        [/missile_frame]
        [frame]
            begin=-300
            end=-200
            image="units/enemies/steelhive/drone.png"
        [/frame]
        [if]
            hits=no
            [frame]
                begin=-200
                end=-100
                image="units/enemies/steelhive/drone-ranged-1.png"
                sound=hiss.wav
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                begin=-200
                end=-100
                image="units/enemies/steelhive/drone-ranged-1.png"
                sound=explosion.ogg
            [/frame]
        [/else]
        [frame]
            begin=-100
            end=0
            image="units/enemies/steelhive/drone-ranged-2.png"
        [/frame]
        [frame]
            begin=0
            end=100
            image="units/enemies/steelhive/drone-ranged-1.png"
        [/frame]
        [frame]
            begin=100
            end=200
            image="units/enemies/steelhive/drone.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            [not]
                special_id=explosive detonate
            [/not]
        [/filter_attack]
        [missile_frame]
            begin=-200
            end=0
            image="projectiles/shockmissile-n.png"
            image_diagonal="projectiles/shockmissile-ne.png"
        [/missile_frame]
        [frame]
            begin=-300
            end=-200
            image="units/enemies/steelhive/drone.png"
        [/frame]
        [if]
            hits=no
            [frame]
                begin=-200
                end=-100
                image="units/enemies/steelhive/drone-ranged-1.png"
                sound=magic-dark-big-miss.ogg
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                begin=-200
                end=-100
                image="units/enemies/steelhive/drone-ranged-1.png"
                sound=lightning.ogg
            [/frame]
        [/else]
        [frame]
            begin=-100
            end=0
            image="units/enemies/steelhive/drone-ranged-2.png"
        [/frame]
        [frame]
            begin=0
            end=100
            image="units/enemies/steelhive/drone-ranged-1.png"
        [/frame]
        [frame]
            begin=100
            end=200
            image="units/enemies/steelhive/drone.png"
        [/frame]
    [/attack_anim]
Speak softly, and carry Doombringer.
gnombat
Posts: 710
Joined: June 10th, 2010, 8:49 pm

Re: Filter weapon special in attack_anim

Post by gnombat »

white_haired_uncle wrote: April 16th, 2024, 4:22 pm Bonus question: I'm looking for "explosion-miss.ogg", the sound of an explosive attack failing to ignite. It might be called fizzle.ogg. Anyone have anything FOSS?
thunderstick-miss.ogg?
Post Reply