How to remove a unit type's attack special

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
H-Hour
Posts: 222
Joined: April 14th, 2010, 12:27 pm

How to remove a unit type's attack special

Post by H-Hour »

I have a unit that uses [base_unit] to extend the Spearman. I would like to remove the first strike attack special for my unit.

I'm having a hard time figuring out how to use remove_specials. The examples in the forum all use [effect] but I have so far been unable to figure out the correct syntax to make it work in this case. And I didn't find any uses of it in the core WML code, for obvious reasons.

Here is my code:

Code: Select all

[unit_type]
	[base_unit]
		id=Spearman
	[/base_unit]
	...

	[attack]
		name=spear
		description=_"spear"
		type=pierce
		range=melee
		damage=6
		number=2
		icon=attacks/spear.png
	[/attack]

	...

	[effect]
		apply_to=attack
		remove_specials=firststrike
	[/effect]
[/unit_type]
I have also tried the following:

Code: Select all

[unit_type]
	[base_unit]
		id=Spearman
	[/base_unit]
	...

	[attack]
		name=spear
		description=_"spear"
		type=pierce
		range=melee
		damage=6
		number=2
		icon=attacks/spear.png
	[/attack]

	...

	[effect]
		apply_to=attack
		[attack]
			[filter]
				name=spear
			[/filter]
		[/attack]
		remove_specials=firststrike
	[/effect]
[/unit_type]
And the following:

Code: Select all

[unit_type]
	[base_unit]
		id=Spearman
	[/base_unit]
	...

	[attack]
		name=spear
		description=_"spear"
		type=pierce
		range=melee
		damage=6
		number=2
		icon=attacks/spear.png
		[effect]
			[attack]
				remove_specials=firststrike
			[/attack]
		[/effect]
	[/attack]

	...
	
[/unit_type]
Does anyone know how this should be used?
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How to remove a unit type's attack special

Post by Ravana »

UnitTypeWML for that unit is copied into this one, as if by [set_variables]mode=merge
I understand documentation that special should have __remove=yes.

[effect] is not recognized subtag of [unit_type].
H-Hour
Posts: 222
Joined: April 14th, 2010, 12:27 pm

Re: How to remove a unit type's attack special

Post by H-Hour »

Thank you Ravana! Can I ask where you found this in the documentation?

For anyone else who finds this thread, the working solution was:

Code: Select all

[unit_type]
	[base_unit]
		id=Spearman
	[/base_unit]

	...

	[attack]
		name=spear
		description=_"spear"
		type=pierce
		range=melee
		damage=6
		number=2
		icon=attacks/spear.png
		[specials]
			__remove=yes
		[/specials]
	[/attack]

	...

[/unit_type]
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How to remove a unit type's attack special

Post by Ravana »

https://wiki.wesnoth.org/UnitTypeWML#Other_tags
> UnitTypeWML for that unit is copied into this one, as if by [set_variables]mode=merge
>> https://wiki.wesnoth.org/InternalAction ... riables.5D
>>> __remove=yes: When used in a subtag, causes the corresponding subtag in name to be deleted rather than merged. Deletion happens after any other subtags have been merged.
H-Hour
Posts: 222
Joined: April 14th, 2010, 12:27 pm

Re: How to remove a unit type's attack special

Post by H-Hour »

Got it, thanks!
Post Reply