Custom Ability not found

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
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Custom Ability not found

Post by JustNatan »

Hey,
I tried to add a new ability which is basically just a derivation of mainline leadership:

Code: Select all

#textdomain wesnoth-RotT
#define ABILITY_LEADERSHIPX STR
    # Canned definition of the Leadership ability to be included in an
    # [abilities] clause.
    [leadership]
        id=leadership
        value="({STR} * (level - other.level))"
        cumulative=no
        name= _ "leadership"
        female_name= _ "female^leadership"
        description= _ "This unit can lead your own units that are next to it, making them fight better.

Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do more damage times the difference in their levels."
        affect_self=no
        [affect_adjacent]
            [filter]
                formula="level < other.level"
            [/filter]
        [/affect_adjacent]
    [/leadership]
#enddef
to simple derivatives of the mainline units for example

Code: Select all

#textdomain wesnoth-RotT
[unit_type]
    id=LieutenantX
    name= _ "Lieutenant"
    race=human
    image="units/human-loyalists/lieutenant.png"
    profile="portraits/humans/lieutenant.png"
    {LEADING_ANIM "units/human-loyalists/lieutenant-lead-2.png" "units/human-loyalists/lieutenant-lead-1.png" -5,-28}
    hitpoints=45
    movement_type=smallfoot
    movement=6
    experience=70
    level=2
    alignment=lawful
    advances_to=GeneralX
    cost=34
    usage=fighter
    description= _ "Lieutenants are some of the more respected commanding officers among humans and are often seen leading smaller-scale incursions and managing the battlefield. Trained both with sword and crossbow, they excel at neither, and are somewhat less resilient than the warlords of other races — this is more than made up for by their superior knowledge and training in military strategy."
    {NOTE_LEADERSHIP}
    die_sound={SOUND_LIST:HUMAN_DIE}
    {DEFENSE_ANIM_RANGE "units/human-loyalists/lieutenant-defend.png" "units/human-loyalists/lieutenant.png" {SOUND_LIST:HUMAN_HIT} melee}
    {DEFENSE_ANIM_RANGE "units/human-loyalists/lieutenant-crossbow-defend.png" "units/human-loyalists/lieutenant-crossbow.png" {SOUND_LIST:HUMAN_HIT} ranged}
    [abilities]
        {ABILITY_LEADERSHIPX 30}
    [/abilities]
    [attack]
        name=sword
        description=_"sword"
        icon=attacks/sword-human.png
        type=blade
        range=melee
        damage=8
        number=3
    [/attack]
    [attack]
        name=crossbow
        description=_"crossbow"
        icon=attacks/crossbow-human.png
        type=pierce
        range=ranged
        damage=4
        number=3
    [/attack]
    [idle_anim]
        {STANDARD_IDLE_FILTER}
        start_time=0
        [frame]
            image="units/human-loyalists/lieutenant-idle-[1~8,7~5,9,1].png:[100*2,300,50*4,500,100*5]"
        [/frame]
    [/idle_anim]

    [death]
        start_time=0
        [frame]
            image="units/human-loyalists/lieutenant-die-[1~9].png:75"
        [/frame]
    [/death]
    [attack_anim]
        [filter_attack]
            name=crossbow
        [/filter_attack]
        missile_start_time=-150
        [missile_frame]
            duration=150
            image="projectiles/missile-n.png"
            image_diagonal="projectiles/missile-ne.png"
        [/missile_frame]
        start_time=-400
        [frame]
            image="units/human-loyalists/lieutenant-crossbow.png:100"
        [/frame]
        {SOUND:HIT_AND_MISS crossbow.ogg crossbow-miss.ogg -300}
        [frame]
            image="units/human-loyalists/lieutenant-crossbow-attack[1~2].png:150"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=sword
        [/filter_attack]
        start_time=-225
        [frame]
            image="units/human-loyalists/lieutenant.png:50"
        [/frame]
        [frame]
            image="units/human-loyalists/lieutenant-attack-sword-[1~3].png:[75,150,100]"
        [/frame]
        {SOUND:HIT_AND_MISS {SOUND_LIST:SWORD_SWISH} {SOUND_LIST:MISS} -100}
    [/attack_anim]
[/unit_type]
I have both units and macros read in the main.cfg

Code: Select all

#ifdef CAMPAIGN_RotT
[binary_path]
    path=data/add-ons/RiseOfTheTrolls/
[/binary_path]

[+units]
{~add-ons/RiseOfTheTrolls/units}
[/units]
{~add-ons/RiseOfTheTrolls/scenarios}
{~add-ons/RiseOfTheTrolls/macros}
#endif
But it throws these errors:

Code: Select all

Setting mode to 1600x900
20210304 11:07:09 warning config: add-on 'Under_the_Burning_Suns' has no _info.cfg; cannot read version info
Checking lua scripts... ok
20210304 11:07:11 error display: could not open image 'portraits/khalifate/hakim.png'
#the above don't matter probably
20210304 11:07:13 error preprocessor: Macro/file 'ABILITY_LEADERSHIPX' is missing
at ~add-ons/RiseOfTheTrolls/units/Loyalist_General.cfg:35
    included from ~add-ons/RiseOfTheTrolls/_main.cfg:36
20210304 11:07:13 error config: error reading usermade add-on '/home/xaver/.var/app/org.wesnoth.Wesnoth/data/wesnoth/1.15/data/add-ons/RiseOfTheTrolls/_main.cfg'
20210304 11:07:13 error config: Macro/file 'ABILITY_LEADERSHIPX' is missing
at ~add-ons/RiseOfTheTrolls/units/Loyalist_General.cfg:35
    included from ~add-ons/RiseOfTheTrolls/_main.cfg:36
#I guess this issue below is a separate one
20210304 11:07:21 error engine: Couldn't find [scenario] with id=trolls_intro2
20210304 11:07:21 error general: Failed to load the scenario
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Custom Ability not found

Post by JustNatan »

Closed. Octalot helped me here:
viewtopic.php?f=21&t=54007

The error wasn't rooted in the new ability.
Post Reply