Difference between revisions of "EffectWML"
From The Battle for Wesnoth Wiki
				
				
		
		 (→the [effect] tag:  add warning about using this to change status)  | 
				m (holy bad formatting batman)  | 
				||
| Line 11: | Line 11: | ||
   matches ''unit_type'' (can be a list of types).  |    matches ''unit_type'' (can be a list of types).  | ||
* ''apply_to'' describes what the effect actually affects.  | * ''apply_to'' describes what the effect actually affects.  | ||
| − | [effect] uses different keys depending on the value of ''apply_to''.  | + | [effect] uses different keys depending on the value of ''apply_to''.  ''apply_to'' can take the following values:  | 
| − | + | * "new_attack" will use all other keys and tags as the description of an attack that will be added to the unit. See [[AttackWML]].  | |
| − | ''apply_to'' can take the following values:  | + | * "attack" find an attack and modify it.  All tags from the attack filter construct will be used to match the attack; see [[FilterWML]].  After that, the following tags can be used to modify the attack.  | 
| − | * "new_attack" will use all other keys and tags as the description of an attack that will be  | ||
| − | |||
| − | * "attack" find an attack and modify it.  | ||
| − | |||
| − | |||
** ''set_name'' change the attack's name.  | ** ''set_name'' change the attack's name.  | ||
| − | ** ''set_type'' change the attack type. Values are 'blade',  | + | ** ''set_type'' change the attack type. Values are 'blade', 'pierce', 'impact', 'fire', 'cold', and 'holy'.  | 
| − | + | ** ''set_special'' change the attack's special effects.  See [[AbilitiesWML]] for a list of possible values.  | |
| − | ** ''set_special'' change the attack's special effects.  | + | ** ''increase_damage'' increases the attack's damage.  This can be positive or negative, so you can use it to decrease damage as well.  If it ends in a percent(''''%''''), the change in damage will be a percentage ratio of the attack's original damage.  | 
| − | + | ** ''increase_attacks'' increases the number of attack strikes. Like ''increase_damage'', it can be positive or negative, or a percentage.  | |
| − | ** ''increase_damage'' increases the attack's damage.  | ||
| − | |||
| − | |||
| − | |||
| − | ** ''increase_attacks'' increases the number of attack strikes. Like  | ||
| − | |||
* "hitpoints" modifies the unit's HP and/or max HP.  | * "hitpoints" modifies the unit's HP and/or max HP.  | ||
** ''increase'' the amount to increase the unit's HP.  | ** ''increase'' the amount to increase the unit's HP.  | ||
| − | ** ''heal_full'' if present  and not set to "no" the unit  | + | ** ''heal_full'' if present  and not set to "no" the unit will be put back to full HP.  | 
| − | + | ** ''increase_total'' will increase the total HP of the unit.  Can be specified either as a negative or a positive value.  It can also be specified as a percentage of the current total; i.e. "-50%" will cut max HP in half.  | |
| − | ** ''increase_total'' will increase the total HP of the unit.  | + | ** ''violate_max'' it the unit ends up with more than its max HP after these modifications, and this key is present, the unit's HP won't be lowered to its max HP  | 
| − | |||
| − | |||
| − | |||
| − | ** ''violate_max'' it the unit ends up with more than its max HP  | ||
| − | |||
| − | |||
* "movement" modifies the unit's movement points.  | * "movement" modifies the unit's movement points.  | ||
| − | ** ''increase'' maximum movement is increased by this amount.  | + | ** ''increase'' maximum movement is increased by this amount. It can be positive, negative, or specified as a percentage.  | 
| − | |||
** ''set'' maximum movement is set to a specific value.  | ** ''set'' maximum movement is set to a specific value.  | ||
* "max_experience" affects the amount of XP the unit needs for the next level.  | * "max_experience" affects the amount of XP the unit needs for the next level.  | ||
| − | ** ''increase'' how to change the xp; again it can be negative,  | + | ** ''increase'' how to change the xp; again it can be negative, positive or a percentage.  | 
| − | |||
* "loyal" no keys associated. The affected unit will be loyal i.e have an upkeep of 0.  | * "loyal" no keys associated. The affected unit will be loyal i.e have an upkeep of 0.  | ||
* "status" modifies the status affecting the unit.  | * "status" modifies the status affecting the unit.  | ||
| − | ** ''add'' a list of status modifications to add. Beware, these may be reapplied later, such as when the unit is recalled or levels up; if in an event, you can use [[InternalActionsWML|[store_unit]]] and [[DirectActionsWML|[unstore_unit]]], modifying unit.status.name directly, to avoid this, or if you are creating the unit, you can just add it to the unit's [status] tag in the [unit] tag.  | + | ** ''add'' a list of status modifications to add. Beware, these may be reapplied later, such as when the unit is recalled or levels up; if in an event, you can use [[InternalActionsWML|[store_unit]]] and [[DirectActionsWML|[unstore_unit]]], modifying unit.status.name directly, to avoid this, or if you are creating the unit, you can just add it to the unit's [status] tag in the [unit] tag.  These are listed in [status], [[SingleUnitWML]].  | 
| − | |||
** ''remove'' a list of status modifications to remove.  | ** ''remove'' a list of status modifications to remove.  | ||
Revision as of 18:03, 27 September 2005
the [effect] tag
The tag [effect] is used to describe one modification to a unit. Any number of [effect] tags can be used to describe a complete modification. Modifications are permanent changes to a unit; currently there is no way of removing a modification.
The following keys are always recognized for [effect]:
- unit_type only apply this effect if the affected unit's type name
 
matches unit_type (can be a list of types).
- apply_to describes what the effect actually affects.
 
[effect] uses different keys depending on the value of apply_to. apply_to can take the following values:
- "new_attack" will use all other keys and tags as the description of an attack that will be added to the unit. See AttackWML.
 - "attack" find an attack and modify it.  All tags from the attack filter construct will be used to match the attack; see FilterWML.  After that, the following tags can be used to modify the attack.
- set_name change the attack's name.
 - set_type change the attack type. Values are 'blade', 'pierce', 'impact', 'fire', 'cold', and 'holy'.
 - set_special change the attack's special effects. See AbilitiesWML for a list of possible values.
 - increase_damage increases the attack's damage. This can be positive or negative, so you can use it to decrease damage as well. If it ends in a percent('%'), the change in damage will be a percentage ratio of the attack's original damage.
 - increase_attacks increases the number of attack strikes. Like increase_damage, it can be positive or negative, or a percentage.
 
 - "hitpoints" modifies the unit's HP and/or max HP.
- increase the amount to increase the unit's HP.
 - heal_full if present and not set to "no" the unit will be put back to full HP.
 - increase_total will increase the total HP of the unit. Can be specified either as a negative or a positive value. It can also be specified as a percentage of the current total; i.e. "-50%" will cut max HP in half.
 - violate_max it the unit ends up with more than its max HP after these modifications, and this key is present, the unit's HP won't be lowered to its max HP
 
 - "movement" modifies the unit's movement points.
- increase maximum movement is increased by this amount. It can be positive, negative, or specified as a percentage.
 - set maximum movement is set to a specific value.
 
 - "max_experience" affects the amount of XP the unit needs for the next level.
- increase how to change the xp; again it can be negative, positive or a percentage.
 
 - "loyal" no keys associated. The affected unit will be loyal i.e have an upkeep of 0.
 - "status" modifies the status affecting the unit.
- add a list of status modifications to add. Beware, these may be reapplied later, such as when the unit is recalled or levels up; if in an event, you can use [store_unit] and [unstore_unit], modifying unit.status.name directly, to avoid this, or if you are creating the unit, you can just add it to the unit's [status] tag in the [unit] tag. These are listed in [status], SingleUnitWML.
 - remove a list of status modifications to remove.