Modifying base 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.
Post Reply
User avatar
Chtomorc
Posts: 68
Joined: June 9th, 2011, 2:48 pm
Location: Paris, France.

Modifying base unit

Post by Chtomorc »

Hi, I need some help with WML, and I has been told it could be answered here :P

I have trouble with the use of [base_unit] tag.
My problem is : I can't remove the fire ranged attack of the orcish archer without copy and paste the all .cfg file (which is inelegant).

This code replace correctly the melee and pierce ranged attack damages and numbers, but don't modify the attack I want to remove. May you help me ?

Code: Select all

[unit_type]
    id=TOTN_Orcish_Archer
    [base_unit]
        id=Orcish Archer
    [/base_unit]
    race=orc_plunderer
    advances_to=TOTN_Orcish_Crossbowman
    [effect]
        apply_to=remove_attacks
        [remove_attacks]
            type=fire
        [/remove_attacks]
    [/effect]
    [attack]
        name=dagger
        damage=6
        number=1
    [/attack]
    [attack]
        name=bow
        type=pierce
        damage=8
        number=2
    [/attack]
[/unit_type]
My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
User avatar
Pentarctagon
Project Manager
Posts: 5732
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Modifying base unit

Post by Pentarctagon »

Quite possibly because there is no such tag as [remove_attacks]
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Modifying base unit

Post by Anonymissimus »

Chtomorc wrote:

Code: Select all

[unit_type]
#...
    [effect]
        apply_to=remove_attacks
        [remove_attacks]
#...
You make up stuff. Look in the wiki what's allowed where before writing wml.

That being said I'd try removing the base unit's third attack with an empty [attack] block. If that doesn't work: no way.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
Chtomorc
Posts: 68
Joined: June 9th, 2011, 2:48 pm
Location: Paris, France.

Re: Modifying base unit

Post by Chtomorc »

Thanks for this quick answers.

I found the remove_ attacks tag in the EffectWML wiki page, maybe I misemployed it. Do not speak english well and being new to WML don't help me.

Make an empty attack tag don't seem to work. I think I have to copy the entire file and just delete the attack I want to remove... Inelegant but it will work :annoyed:
My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
User avatar
boru
Posts: 788
Joined: November 19th, 2009, 11:02 pm

Re: Modifying base unit

Post by boru »

Chtomorc, look at the utils.cfg file in Heir to the Throne to see an example of how to remove an attack.
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien

My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
User avatar
Chtomorc
Posts: 68
Joined: June 9th, 2011, 2:48 pm
Location: Paris, France.

Re: Modifying base unit

Post by Chtomorc »

Thanks, boru. I found the file, but I add already try this code (the one I show you wasn't my first attempt by far).

Code: Select all

[unit_type]
...
[effect]
    apply_to=remove_attacks
    range=ranged
    type=fire
[/effect]
...
[/unit_type]
It doesn't work in a unit_type tag by just adding this lines, or maybe I missed something. I think you have to set an attack to replace the one you remove....
As I said, I have made a copy of the mainline files, which is ugly, but work fine :P
My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Modifying base unit

Post by zookeeper »

Chtomorc wrote:

Code: Select all

[unit_type]
...
[effect]
    apply_to=remove_attacks
    range=ranged
    type=fire
[/effect]
...
[/unit_type]
It doesn't work in a unit_type tag by just adding this lines, or maybe I missed something.
Anonymissimus wrote:You make up stuff. Look in the wiki what's allowed where before writing wml.
EffectWML is only allowed where the WML reference tells you you can use EffectWML. Does UnitTypeWML say that you can put an [effect] in [unit_type]? No, therefore it doesn't do anything there.
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Modifying base unit

Post by Max »

as Anonymissimus said you can't use [effect] here. i don't think there's a way to do that without using any kind of events...
User avatar
Chtomorc
Posts: 68
Joined: June 9th, 2011, 2:48 pm
Location: Paris, France.

Re: Modifying base unit

Post by Chtomorc »

zookeeper wrote: EffectWML is only allowed where the WML reference tells you you can use EffectWML. Does UnitTypeWML say that you can put an [effect] in [unit_type]? No, therefore it doesn't do anything there.
As I said, I'm not so good in english. I read different wiki pages, and don't find the reference which tell where the EffectWML apply... In the EffectWML page, it only say that it's used to apply modifications to units, that's what lead me to misemployed it. However, it is not describe in the unit_filter tag page. I think that mean it don't belong there. I'll be more carefull with this implicit formulation next time.

At least, it's not so important because there is an easy (but I still think very inelegant) way to make it.
Thanks for all your answers anyway, my issue is solved.
My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
User avatar
cylosae
Posts: 19
Joined: August 15th, 2008, 12:57 am

Re: Modifying base unit

Post by cylosae »

Eventhough it already been solved, but..may be you want to try it.
removing attacks is impossible inside [unit_type] tag..but it can be applied inside [unit] tag once you make a scenario..
I think it a little bit elegant.. :wink:
you can make a macro for it if you have to..

Code: Select all

[unit]
    ....
    [modifications]
        ....      
        [object]
            [effect]
                apply_to=remove_attacks
                type=fire
            [/effect]
        [/object]
    [/modifications]
    ....
[/unit]
monochromatic
Posts: 1549
Joined: June 18th, 2009, 1:45 am

Re: Modifying base unit

Post by monochromatic »

Just use unit_type.base_unit and make your changes.
User avatar
Chtomorc
Posts: 68
Joined: June 9th, 2011, 2:48 pm
Location: Paris, France.

Re: Modifying base unit

Post by Chtomorc »

Thanks, but as I said, it don't work, because I want to modify a unit for an MP era. It has to be in a unit_type tag :)
Though the code you give me will be helpful in my campaign.

@ monochromatic : that's what I have done. But as everyone said : remove_attacks don't work inside a unit_type tag.
My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Modifying base unit

Post by Anonymissimus »

Chtomorc wrote:Thanks, but as I said, it don't work, because I want to modify a unit for an MP era. It has to be in a unit_type tag :)
Though the code you give me will be helpful in my campaign.

@ monochromatic : that's what I have done. But as everyone said : remove_attacks don't work inside a unit_type tag.
You could use some sort of event-driven dummy ability for unit-related events (maybe recruit, recall and attack) which applies that object removing the attack in that event. [unit_type][event] is valid, look for the feeding ability in core as an example. I'm just not sure whether you can make it so that this dummy ability will be invisible to the user. Try leaving the keys giving the name and description empty.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Post Reply