Custom Unit

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.
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Custom Unit

Post by Daseka »

Hello, first of all, I am very new in modding, so I apologize for the stupid mistakes I may have made. And second, English is not my mother tongue. After having clarified that, I continue.
I'm trying to include Robin (from Fire Emblem Awakening), but I can not get the unit to be in the game. Here is everything I have.

Code: Select all

#textdomain wesnoth-units
[unit_type]
    id=robin
    name= _ "Robin"
    # wmllint: general spelling mage mages magery magecraft
    race=human
    gender=male,female
    image="units/awakening/Robin.png"
    profile="portraits/humans/mage.png"
    hitpoints=24
    movement_type=smallfoot
    movement=5
    experience=50
    level=1
    alignment=lawful
    advances_to=Grima,Robin GE
    cost=20
    usage=mixed fighter
    description= _ "El pasado de Robin es un misterio, convirtiéndose en el mayor enigma dentro de los Custodios. A pesar de esto, la habilidad de Robin como estratega no tiene rival, lo que le permite guiar al ejército de Chrom a la victoria sobre las fuerzas enemigas mayores en número y, posiblemente, incluso superando la experiencia de sus enemigos."+{SPECIAL_NOTES}+{SPECIAL_NOTES_MAGICAL}
    die_sound={SOUND_LIST:HUMAN_DIE}
    {DEFENSE_ANIM "units/awakening/Attack1M.png" "units/awakening/Robin.png" {SOUND_LIST:HUMAN_OLD_HIT} }
    [attack]
        name=espada trueno
        description=_"Espada Trueno"
        icon=attacks/staff-magic.png
        type=blade
        range=melee
        damage=5
        number=2
    [/attack]
    [attack]
        name=thoron
        description=_"Thoron"
        icon=attacks/magic-missile.png
        type=impact
        range=ranged
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        damage=7
        number=2
    [/attack]
    [attack_anim]
        [filter_attack]
            name=missile
        [/filter_attack]

        offset=0

        {MAGIC_MISSILE 11 -20}
        {MAGIC_MISSILE_STAFF_FLARE -750 600 11 -20}

        start_time=-800
        [frame]
            image="units/awakening/M-Attack[1,2,3,4].png:[100,700,200]"
        [/frame]
        # wmlscope: start ignoring
        {SOUND:HIT_AND_MISS magic-missile-[1~3].ogg magic-missile-[1~3]-miss.ogg -350}
        # wmlscope: stop ignoring
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=staff
        [/filter_attack]
        start_time=-250
        [frame]
            image="units/human-magi/mage.png:50"
        [/frame]
        [frame]
            image="units/human-magi/mage-attack-staff[1~2].png:[100,200]"
        [/frame]
        {SOUND:HIT_AND_MISS staff.ogg staff-miss.ogg -125}
        [frame]
            image="units/human-magi/mage-attack-magic1.png:50"
        [/frame]
        [frame]
            image="units/human-magi/mage.png:50"
        [/frame]
    [/attack_anim]
    [female]
        name= _ "female^Mage"
        gender=female
        image="units/human-magi/mage+female.png"
        profile="portraits/humans/mage+female.png"
        die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
        {DEFENSE_ANIM "units/human-magi/mage+female-defend.png" "units/human-magi/mage+female.png" {SOUND_LIST:HUMAN_FEMALE_HIT} }
        [attack_anim]
            [filter_attack]
                name=missile
            [/filter_attack]
            offset=0
            {MAGIC_MISSILE 11 -20}
            {MAGIC_MISSILE_STAFF_FLARE -750 600 11 -20}
            [frame]
                image="units/human-magi/mage+female-attack-magic[1,2,1].png:[100,700,200]"
            [/frame]
        [/attack_anim]
        [attack_anim]
            [filter_attack]
                name=staff
            [/filter_attack]
            [frame]
                image="units/human-magi/mage+female.png:50"
            [/frame]
            [frame]
                image="units/human-magi/mage+female-attack-staff[1~2].png:[100,200]"
            [/frame]
            [frame]
                image="units/human-magi/mage+female-attack-magic1.png:50"
            [/frame]
            [frame]
                image="units/human-magi/mage+female.png:50"
            [/frame]
        [/attack_anim]
    [/female]
[/unit_type]
I made a folder located in wesnoth/data/add-ons/A_Simple_Addon/units , and the same for the sprites (/A_Simple_Addon/images/units/awakening). And in the "A_Simple_Addon" folder i have a _main.cfg; here it is.

Code: Select all

[binary_path]
    path=data/add-ons/A_Simple_Addon
[/binary_path]

[+units]
    {~add-ons/A_Simple_Addon/units}
[/units]

{~add-ons/A_Simple_Addon/images}

Any help will be very helpful. Sorry again for my spelling if anything is wrong written.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom Unit

Post by Pentarctagon »

What folder is the unit cfg in?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Re: Custom Unit

Post by Daseka »

It's in the units folder.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom Unit

Post by Pentarctagon »

Where are you expecting the unit to show up?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Re: Custom Unit

Post by Daseka »

For now, I want to see if I manage to put the data in-game, so I added Robin as a leader option inside the multiplayer/factions/undead_default.cfg; if I don't remember wrong.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom Unit

Post by Pentarctagon »

"Robin" or "robin"? You'll need to use the id rather than the name.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Re: Custom Unit

Post by Daseka »

I'm sorry, it was corrected automatically. It's robin.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom Unit

Post by Pentarctagon »

Can you post the contents of your modified multiplayer/factions/undead_default.cfg?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Re: Custom Unit

Post by Daseka »

Here it is.

Code: Select all

#textdomain wesnoth-multiplayer
[multiplayer_side]
    id=Undead
    name= _"Undead"
    image="units/undead-necromancers/dark-sorcerer.png"
    type=random
    leader=Dark Sorcerer,Revenant,Deathblade,Bone Shooter,Necrophage,robin
    random_leader=Dark Sorcerer,Revenant,Deathblade,Bone Shooter
    recruit=Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul,robin
    terrain_liked=Ss, Hh, Ha, Ww
    # wmllint: markcheck off
    description="<img>src='portraits/undead/spectre.png~BG()' align='middle'</img>

"+_"The <bold>text='Undead'</bold> are a faction of <ref>text='undead' dst='..race_undead'</ref> creatures and <ref>text='human' dst='..race_human'</ref> practitioners of dark arts that usually accompany them. Often, these “Dark Adepts” are the units that do the most damage for the faction, but they have a major vulnerability — their practicing of this forbidden, evil magic has consumed all their energy and so they have no melee attack at all. The Undead are a very aggressive faction and the most powerful <ref>text='Default Era' dst='..era_era_default'</ref> faction at nighttime."
    # wmllint: markcheck on
    [ai]
        recruitment_pattern=fighter,fighter,archer,fighter,scout,archer
    [/ai]
[/multiplayer_side]
Also, now that I think about it, for this unit, in addition to the unit sprites and .cfg, is there anything else I should put in the "A_Simple_Addon" folder?
maybe that´s the problem, I don´t know.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom Unit

Post by Pentarctagon »

With the add-on set up as attached and the "robin" ID added like you have below, the unit does show up for me in leader selection for the undead. I'm not sure how it's different than what you have though.
Attachments
A_Simple_Addon.zip
(2.08 KiB) Downloaded 382 times
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Re: Custom Unit

Post by Daseka »

I do not know how, but at least the unit "show up", I can choose it but it appears as "?" Instead of robin, and when I try it in a local game, the game starts already won.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom Unit

Post by Pentarctagon »

Which scenario are you starting?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Re: Custom Unit

Post by Daseka »

The lair of the onis, I´m not sure if that´s the name in the english version. But here is the image.
Image
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom Unit

Post by Pentarctagon »

Do you have any other add-ons, or is there more to your add-on than what you've posted so far? I'm not able to reproduce that problem.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Daseka
Posts: 9
Joined: June 18th, 2018, 10:59 pm

Re: Custom Unit

Post by Daseka »

No, this is all i got
Attachments
A_Simple_Addon.rar
(18.69 KiB) Downloaded 382 times
Post Reply