Male/female unit different attacks

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
ulfgur
Posts: 88
Joined: December 16th, 2008, 1:01 am

Male/female unit different attacks

Post by ulfgur »

Okay, I'm making a unit that has the whole male/female variation. I want one male to have a fire attack, and female to have a ice attack. I've already tried a whole bunch of filters and if tags on both the male and female code. How do i go about this?

Code: Select all


#textdomain wesnoth-units
[unit_type]
    id=Kidsfolk Shaman
    name= _ "Kidsfolk Shaman"
    race=human
    gender=male,female
    image="units/kidsfolk/shaman.png"
    {MAGENTA_IS_THE_TEAM_COLOR}
    profile="portraits/elves/ranger.png"
    hitpoints=30
    movement_type=woodland
    movement=6
    experience=40
    level=1
    alignment=neutral
    advances_to=null
    {AMLA_DEFAULT}
    undead_variation=archer
    cost=15
    usage=mixed fighter
    description= _ "Kidsfolk shamans control the forces of nature."+{SPECIAL_NOTES}+{SPECIAL_NOTES_AMBUSH}
    die_sound={SOUND_LIST:ELF_HIT}
    [portrait]
        size=400
        side="left"
        mirror="false"
        image="portraits/elves/transparent/ranger.png"
    [/portrait]
    [portrait]
        size=400
        side="right"
        mirror="true"
        image="portraits/elves/transparent/ranger.png"
    [/portrait]
    [movement_costs]
        shallow_water=2
        mountains=2
    [/movement_costs]
    [defense]
        shallow_water=70
        swamp_water=60
        sand=60
    [/defense]
    [attack]
        [filter]
            gender=male
        [/filter]
        name=flame burst
        description=_"Fireburst"
        icon=attacks/sword-elven.png
        type=fire
        range=melee
        damage=5
        number=4
    [/attack]
    {DEFENSE_ANIM_RANGE "units/kidsfolk/shaman-defend.png" "units/kidsfolk/shaman-defend.png" {SOUND_LIST:ELF_HIT} melee}
    {DEFENSE_ANIM_RANGE "units/kidsfolk/shaman-defend.png" "units/kidsfolk/shaman-defend.png" {SOUND_LIST:ELF_HIT} ranged}
    [attack_anim]
        [filter_attack]
            name=flame burst
        [/filter_attack]

        start_time=-400
        offset=0.0

        flame_burst_1_start_time=-400
        flame_burst_2_start_time=-350
        flame_burst_3_start_time=-300
        flame_burst_4_start_time=-250
        flame_burst_5_start_time=-200

        [if]
            direction=se,s,sw
        [frame]
            sound=fire.wav
            duration=100
            image=units/kidsfolk/shaman-attack-1.png
        [/Proxy-Connection: keep-alive
Cache-Control: max-age=0

ame]
        [frame]
            duration=100
      Proxy-Connection: keep-alive
Cache-Control: max-age=0

    image=units/kidsfolk/shaman-attack-2.png
        [/frame]
        [frame]
            duration=200
            image=units/kidsfolk/shaman-attack-3.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-4.png
        [/frame]

            [flame_burst_1_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png~FL(vert):50,halo/flame-burst-2.png~FL(vert):50,halo/flame-burst-3.png~FL(vert):50,halo/flame-burst-4.png~FL(vert):50,halo/flame-burst-5.png~FL(vert):50,halo/flame-burst-6.png~FL(vert):50,halo/flame-burst-7.png~FL(vert):50,halo/flame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=-22,0
                offset=1.0
            [/flame_burst_1_frame]
            [flame_burst_2_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png~FL(vert):50,halo/flame-burst-2.png~FL(vert):50,halo/flame-burst-3.png~FL(vert):50,halo/flame-burst-4.png~FL(vert):50,halo/flame-burst-5.png~FL(vert):50,halo/flame-burst-6.png~FL(vert):50,halo/flame-burst-7.png~FL(vert):50,halo/flame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=-14,9
                offset=1.0
            [/flame_burst_2_frame]
            [flame_burst_3_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png~FL(vert):50,halo/flame-burst-2.png~FL(vert):50,halo/flame-burst-3.png~FL(vert):50,halo/flame-burst-4.png~FL(vert):50,halo/flame-burst-5.png~FL(vert):50,halo/flame-burst-6.png~FL(vert):50,halo/flame-burst-7.png~FL(vert):50,halo/flame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=0,12
                offset=1.0
            [/flame_burst_3_frame]
            [flame_burst_4_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png~FL(vert):50,halo/flame-burst-2.png~FL(vert):50,halo/flame-burst-3.png~FL(vert):50,halo/flame-burst-4.png~FL(vert):50,halo/flame-burst-5.png~FL(vert):50,halo/flame-burst-6.png~FL(vert):50,halo/flame-burst-7.png~FL(vert):50,halo/flame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=14,9
                offset=1.0
            [/flame_burst_4_frame]
            [flame_burst_5_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png~FL(vert):50,halo/flame-burst-2.png~FL(vert):50,halo/flame-burst-3.png~FL(vert):50,halo/flame-burst-4.png~FL(vert):50,halo/flame-burst-5.png~FL(vert):50,halo/flame-burst-6.png~FL(vert):50,halo/flame-burst-7.png~FL(vert):50,halo/flame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=22,0
                offset=1.0
            [/flame_burst_5_frame]
        [/if]
        [else]
            direction=ne,n,nw
        [frame]
            sound=fire.wav
            duration=100
            image=units/kidsfolk/shaman-attack-1.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-2.png
        [/frame]
        [frame]
            duration=200
            image=units/kidsfolk/shaman-attack-3.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-4.png
        [/frame]

            [flame_burst_1_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png:50,halo/flame-burst-2.png:50,halo/flame-burst-3.png:50,halo/flame-burst-4.png:50,halo/flame-burst-5.png:50,halo/flame-burst-6.png:50,halo/flame-burst-7.png:50,halo/flame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=-22,0
                offset=1.0
            [/flame_burst_1_frame]
            [flame_burst_2_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png:50,halo/flame-burst-2.png:50,halo/flame-burst-3.png:50,halo/flame-burst-4.png:50,halo/flame-burst-5.png:50,halo/flame-burst-6.png:50,halo/flame-burst-7.png:50,halo/flame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=-14,9
                offset=1.0
            [/flame_burst_2_frame]
            [flame_burst_3_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png:50,halo/flame-burst-2.png:50,halo/flame-burst-3.png:50,halo/flame-burst-4.png:50,halo/flame-burst-5.png:50,halo/flame-burst-6.png:50,halo/flame-burst-7.png:50,halo/flame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=0,12
                offset=1.0
            [/flame_burst_3_frame]
            [flame_burst_4_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png:50,halo/flame-burst-2.png:50,halo/flame-burst-3.png:50,halo/flame-burst-4.png:50,halo/flame-burst-5.png:50,halo/flame-burst-6.png:50,halo/flame-burst-7.png:50,halo/flame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=14,9
                offset=1.0
            [/flame_burst_4_frame]
            [flame_burst_5_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/flame-burst-1.png:50,halo/flame-burst-2.png:50,halo/flame-burst-3.png:50,halo/flame-burst-4.png:50,halo/flame-burst-5.png:50,halo/flame-burst-6.png:50,halo/flame-burst-7.png:50,halo/flame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=22,0
                offset=1.0
            [/flame_burst_5_frame]
        [/else]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-5.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-6.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-7.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-8.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-9.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-10.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-11.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-12.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman-attack-13.png
        [/frame]
    [/attack_anim]
    [female]
        name= _ "female^shaman"
        gender=female
        image="units/kidsfolk/shaman+female.png"
        profile="portraits/elves/ranger+female.png"
        die_sound={SOUND_LIST:ELF_FEMALE_HIT}
        {DEFENSE_ANIM_RANGE "units/kidsfolk/shaman+female-defend.png" "units/kidsfolk/shaman+female-defend.png" {SOUND_LIST:ELF_FEMALE_HIT} melee}
        {DEFENSE_ANIM_RANGE "units/kidsfolk/shaman+female-defend.png" "units/kidsfolk/shaman+female-defend.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged}
        [portrait]
            size=400
            side="left"
            mirror="false"
            image="portraits/elves/transparent/ranger+female.png"
        [/portrait]
        [portrait]
            size=400
            side="right"
            mirror="true"
            image="portraits/elves/transparent/ranger+female.png"
        [/portrait]
    [attack_anim]
    [attack]
        name=frost burst
        description=_"frostburst"
        icon=attacks/bow-elven.png
        type=cold
        range=melee
        damage=5
        number=4
    [/attack]
        [filter_attack]
            name=frost burst
        [/filter_attack]

        start_time=-400
        offset=0.0

        frost_burst_1_start_time=-400
        frost_burst_2_start_time=-350
        frost_burst_3_start_time=-300
        frost_burst_4_start_time=-250
        frost_burst_5_start_time=-200

        [if]
            direction=se,s,sw
        [frame]
            sound=fire.wav
            duration=100
            image=units/kidsfolk/shaman+female-attack-1.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-2.png
        [/frame]
        [frame]
            duration=200
            image=units/kidsfolk/shaman+female-attack-3.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-4.png
        [/frame]

            [frost_burst_1_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png~FL(vert):50,halo/sflame-burst-2.png~FL(vert):50,halo/sflame-burst-3.png~FL(vert):50,halo/sflame-burst-4.png~FL(vert):50,halo/sflame-burst-5.png~FL(vert):50,halo/sflame-burst-6.png~FL(vert):50,halo/sflame-burst-7.png~FL(vert):50,halo/sflame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=-22,0
                offset=1.0
            [/frost_burst_1_frame]
            [frost_burst_2_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png~FL(vert):50,halo/sflame-burst-2.png~FL(vert):50,halo/sflame-burst-3.png~FL(vert):50,halo/sflame-burst-4.png~FL(vert):50,halo/sflame-burst-5.png~FL(vert):50,halo/sflame-burst-6.png~FL(vert):50,halo/sflame-burst-7.png~FL(vert):50,halo/sflame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=-14,9
                offset=1.0
            [/frost_burst_2_frame]
            [frost_burst_3_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png~FL(vert):50,halo/sflame-burst-2.png~FL(vert):50,halo/sflame-burst-3.png~FL(vert):50,halo/sflame-burst-4.png~FL(vert):50,halo/sflame-burst-5.png~FL(vert):50,halo/sflame-burst-6.png~FL(vert):50,halo/sflame-burst-7.png~FL(vert):50,halo/sflame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=0,12
                offset=1.0
            [/frost_burst_3_frame]
            [frost_burst_4_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png~FL(vert):50,halo/sflame-burst-2.png~FL(vert):50,halo/sflame-burst-3.png~FL(vert):50,halo/sflame-burst-4.png~FL(vert):50,halo/sflame-burst-5.png~FL(vert):50,halo/sflame-burst-6.png~FL(vert):50,halo/sflame-burst-7.png~FL(vert):50,halo/sflame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=14,9
                offset=1.0
            [/frost_burst_4_frame]
            [frost_burst_5_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png~FL(vert):50,halo/sflame-burst-2.png~FL(vert):50,halo/sflame-burst-3.png~FL(vert):50,halo/sflame-burst-4.png~FL(vert):50,halo/sflame-burst-5.png~FL(vert):50,halo/sflame-burst-6.png~FL(vert):50,halo/sflame-burst-7.png~FL(vert):50,halo/sflame-burst-8.png~FL(vert):48,misc/blank-hex.png:1
                halo_x,halo_y=22,0
                offset=1.0
            [/frost_burst_5_frame]
        [/if]
        [else]
            direction=ne,n,nw
        [frame]
            sound=fire.wav
            duration=100
            image=units/kidsfolk/shaman+female-attack-1.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-2.png
        [/frame]
        [frame]
            duration=200
            image=units/kidsfolk/shaman+female-attack-3.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-4.png
        [/frame]

            [frost_burst_1_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png:50,halo/sflame-burst-2.png:50,halo/sflame-burst-3.png:50,halo/sflame-burst-4.png:50,halo/sflame-burst-5.png:50,halo/sflame-burst-6.png:50,halo/sflame-burst-7.png:50,halo/sflame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=-22,0
                offset=1.0
            [/frost_burst_1_frame]
            [frost_burst_2_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png:50,halo/sflame-burst-2.png:50,halo/sflame-burst-3.png:50,halo/sflame-burst-4.png:50,halo/sflame-burst-5.png:50,halo/sflame-burst-6.png:50,halo/sflame-burst-7.png:50,halo/sflame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=-14,9
                offset=1.0
            [/frost_burst_2_frame]
            [frost_burst_3_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png:50,halo/sflame-burst-2.png:50,halo/sflame-burst-3.png:50,halo/sflame-burst-4.png:50,halo/sflame-burst-5.png:50,halo/sflame-burst-6.png:50,halo/sflame-burst-7.png:50,halo/sflame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=0,12
                offset=1.0
            [/frost_burst_3_frame]
            [frost_burst_4_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png:50,halo/sflame-burst-2.png:50,halo/sflame-burst-3.png:50,halo/sflame-burst-4.png:50,halo/sflame-burst-5.png:50,halo/sflame-burst-6.png:50,halo/sflame-burst-7.png:50,halo/sflame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=14,9
                offset=1.0
            [/frost_burst_4_frame]
            [frost_burst_5_frame]
                duration=400
                halo=misc/blank-hex.png:1,halo/sflame-burst-1.png:50,halo/sflame-burst-2.png:50,halo/sflame-burst-3.png:50,halo/sflame-burst-4.png:50,halo/sflame-burst-5.png:50,halo/sflame-burst-6.png:50,halo/sflame-burst-7.png:50,halo/sflame-burst-8.png:48,misc/blank-hex.png:1
                halo_x,halo_y=22,0
                offset=1.0
            [/frost_burst_5_frame]
        [/else]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-5.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-6.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-7.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-8.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-9.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-10.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-11.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-12.png
        [/frame]
        [frame]
            duration=100
            image=units/kidsfolk/shaman+female-attack-13.png
        [/frame]
    [/attack_anim]

    [/female]
[/unit_type]

yeah, yeah, i did steal the animation from the troll shaman. It was just so cool I couldn't resist. ^ _ ^

okay, the little

Code: Select all

[b]s[/b]flame-burst-1.png
thing was intentional. I named the ice animation that way so i could do a "find and replace" thing with ease.

Okay, last time i posted something my computer added something weird to the code while i wasn't looking. If there's some weird tag, it isn't there,

-ulfgur

SkeleRanger
Posts: 151
Joined: August 12th, 2008, 11:10 pm
Location: The Isle of Alduin

Re: Male/female unit different attacks

Post by SkeleRanger »

Try using a [male] tag instead of [filter], sort of like this.

Code: Select all


#textdomain wesnoth-units
[unit_type]
    id=Kidsfolk Shaman
    name= _ "Kidsfolk Shaman"
    race=human
    gender=male,female
    #
    #Common statistics 
    #
    [male]
        name= _ "Shaman"
        gender=male
        #
        #Male variations
        #
    [/male]
    [female]
        name= _ "female^shaman"
        gender=female
        #      
        #Female variations
        #
    [/female]
[/unit_type]

Here's an actual unit that uses this, if you want to look it over.
Attachments
Peasant_Child.cfg
(5.25 KiB) Downloaded 213 times
'We've strayed into a zone with a high magical index... Don't ask me how. Once upon a time a really powerful magic field must have been generated here, and we're feeling the after-effects.'
'Precisely,' said a passing bush.
--Terry Pratchett
Tale of a Mage(finished)
Art for Tale of a Mage

Post Reply