Modifying base unit
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.
Modifying base unit
Hi, I need some help with WML, and I has been told it could be answered here 
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 ?

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
Tribes of the North MP era : factions developpement and unit's sprites
- Pentarctagon
- Project Manager
- Posts: 5732
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Modifying base unit
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
take one down, patch it around
-2,147,483,648 little bugs in the code
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Modifying base unit
You make up stuff. Look in the wiki what's allowed where before writing wml.Chtomorc wrote:Code: Select all
[unit_type] #... [effect] apply_to=remove_attacks [remove_attacks] #...
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 starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: Modifying base unit
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
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

My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
Tribes of the North MP era : factions developpement and unit's sprites
Re: Modifying base unit
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.
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
Re: Modifying base unit
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).
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
Code: Select all
[unit_type]
...
[effect]
apply_to=remove_attacks
range=ranged
type=fire
[/effect]
...
[/unit_type]
As I said, I have made a copy of the mainline files, which is ugly, but work fine

My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
Tribes of the North MP era : factions developpement and unit's sprites
Re: Modifying base unit
Chtomorc wrote:It doesn't work in a unit_type tag by just adding this lines, or maybe I missed something.Code: Select all
[unit_type] ... [effect] apply_to=remove_attacks range=ranged type=fire [/effect] ... [/unit_type]
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.Anonymissimus wrote:You make up stuff. Look in the wiki what's allowed where before writing wml.
Re: Modifying base unit
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...
Re: Modifying base unit
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.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.
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
Tribes of the North MP era : factions developpement and unit's sprites
Re: Modifying base unit
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..
you can make a macro for it if you have to..
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..

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]
-
- Posts: 1549
- Joined: June 18th, 2009, 1:45 am
Re: Modifying base unit
Just use unit_type.base_unit and make your changes.
Re: Modifying base unit
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.

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
Tribes of the North MP era : factions developpement and unit's sprites
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Modifying base unit
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.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.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign