Difference between revisions of "EffectWML"
(Add new times=<integer>) |
Newfrenchy83 (talk | contribs) |
||
(44 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
{{WML Tags}} | {{WML Tags}} | ||
− | 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; | + | == [effect] == |
+ | |||
+ | 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; however using an [[DirectActionsWML#.5Bobject.5D|[object]]] with a limited ''duration'' to apply an [effect] will cause the unit to be rebuilt without the effect's effects when the duration expires. | ||
The following keys and subtags are always recognized: | The following keys and subtags are always recognized: | ||
* '''[filter]''': only apply this effect if the affected unit matches. See [[StandardUnitFilter]] for details. | * '''[filter]''': only apply this effect if the affected unit matches. See [[StandardUnitFilter]] for details. | ||
* '''times''': describes how many times the effect is applied. The default is to apply the effect once. Other possible value : "per level" which means that the effect is applied level times, where level is the unit level. {{DevFeature1.13|5}} Integers are now supported for ''times''. | * '''times''': describes how many times the effect is applied. The default is to apply the effect once. Other possible value : "per level" which means that the effect is applied level times, where level is the unit level. {{DevFeature1.13|5}} Integers are now supported for ''times''. | ||
− | * '''apply_to''': describes what the effect actually affects. | + | * '''apply_to''': describes what the effect actually affects. New effect types can be added with [[LuaAPI/wesnoth#wesnoth.effects]]. Some examples can be seen in [https://github.com/wesnoth/wesnoth/blob/master/data/campaigns/World_Conquest/lua/game_mechanics/effects.lua World Conquest]. |
+ | |||
[effect] uses different keys depending on the value of '''apply_to'''. '''apply_to''' can take the following values: | [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 [attack] in [[UnitTypeWML#Attacks|UnitTypeWML]]. | + | * {{anchor|apply_to-new_attack|'''new_attack'''}}: will use all other keys and tags as the description of an attack that will be added to the unit. See [attack] in [[UnitTypeWML#Attacks|UnitTypeWML]]. |
− | * '''remove_attacks''': remove the matching attacks. All tags from the attack filter construct will be used to match the attack; see [[FilterWML#Filtering Weapons|FilterWML]]. Do not use a [filter] tag otherwise it will not work properly. | + | * {{anchor|apply_to-remove_attacks|'''remove_attacks'''}}: remove the matching attacks. All tags from the attack filter construct will be used to match the attack; see [[FilterWML#Filtering Weapons|FilterWML]]. Do not use a [filter] tag otherwise it will not work properly. |
− | * '''attack''': find an attack and modify it. All tags from the attack filter construct will be used to match the attack; see [[FilterWML#Filtering Weapons|FilterWML]]. After that, the following keys and tags can be used to modify the attack. Note: do not use a [filter] tag. Just put the keys you want to filter on inside the [effect] tag. | + | * {{anchor|apply_to-attack|'''attack'''}}: find an attack and modify it. All tags from the attack filter construct will be used to match the attack; see [[FilterWML#Filtering Weapons|FilterWML]]. After that, the following keys and tags can be used to modify the attack. Note: do not use a [filter] tag. Just put the keys you want to filter on inside the [effect] tag. |
** '''set_name''': change the attack's name (ie identifier). | ** '''set_name''': change the attack's name (ie identifier). | ||
** '''set_description''': change the attack's description (ie displayed name). | ** '''set_description''': change the attack's description (ie displayed name). | ||
** '''set_type''': change the attack type. The standard values are '''blade''', '''pierce''', '''impact''', '''fire''', '''cold''', and '''arcane'''. | ** '''set_type''': change the attack type. The standard values are '''blade''', '''pierce''', '''impact''', '''fire''', '''cold''', and '''arcane'''. | ||
+ | ** '''set_range''': change the attack range. The standard values are '''ranged''' and '''melee'''. | ||
** '''set_icon''': change the attack's icon. | ** '''set_icon''': change the attack's icon. | ||
− | ** '''[set_specials]''': change the attack's specials. The specials to add are given exactly as in the [specials] tag. | + | ** {{anchor|set_specials|'''[set_specials]'''}}: change the attack's specials. The specials to add are given exactly as in the [[AbilitiesWML#The_.5Bspecials.5D_tag|[specials]]] tag. |
*** '''mode''': if '''append''', adds the given specials to the attack. If '''replace''', replaces the existing specials with the given ones. Default '''replace'''. | *** '''mode''': if '''append''', adds the given specials to the attack. If '''replace''', replaces the existing specials with the given ones. Default '''replace'''. | ||
− | ** '''remove_specials''': remove the listed specials. The value of this key is the | + | **** {{DevFeature1.15|3}} A deprecation warning is triggered unless the '''mode''' attribute is set, although the effect will still be '''replace'''. This is to allow the default to change in the 1.17.x series. |
+ | ** '''remove_specials''': remove the listed specials. The value of this key is the comma-separated list of the id of the specials to remove. This key is always evaluated before a [set_specials] tags in the same [effect] | ||
+ | ** '''[remove_specials]''': {{DevFeature1.19|6}} remove the listed specials. Use [[StandardAbilityFilter]], special removed if matches. This tag is always evaluated before a [set_specials] tags in the same [effect] | ||
** '''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_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_attacks''': increases the number of attack strikes. Like '''increase_damage''', it can be positive or negative, or a percentage. | ||
Line 23: | Line 31: | ||
** '''increase_parry''': increases the attack parry bonus; can be positive or negative, or a percentage | ** '''increase_parry''': increases the attack parry bonus; can be positive or negative, or a percentage | ||
** '''increase_movement_used''': {{DevFeature1.13|2}} increases the movement points used by the attack; can be positive or negative, or a percentage | ** '''increase_movement_used''': {{DevFeature1.13|2}} increases the movement points used by the attack; can be positive or negative, or a percentage | ||
+ | ** '''increase_attacks_used''': {{DevFeature1.17|13}} increases the attack points used by the attack; can be positive or negative, or a percentage | ||
** '''set_damage''' {{DevFeature1.13|2}} like increase_damage, but sets the damage to a specific value instead of setting it relative to its original value | ** '''set_damage''' {{DevFeature1.13|2}} like increase_damage, but sets the damage to a specific value instead of setting it relative to its original value | ||
** '''set_attacks''' {{DevFeature1.13|2}} like increase_attacks, but sets the attacks to a specific value instead of setting it relative to its original value | ** '''set_attacks''' {{DevFeature1.13|2}} like increase_attacks, but sets the attacks to a specific value instead of setting it relative to its original value | ||
Line 28: | Line 37: | ||
** '''set_parry''' {{DevFeature1.13|2}} like increase_parry, but sets the parry to a specific value instead of setting it relative to its original value | ** '''set_parry''' {{DevFeature1.13|2}} like increase_parry, but sets the parry to a specific value instead of setting it relative to its original value | ||
** '''set_movement_used''' {{DevFeature1.13|2}} like increase_movement_used, but sets the movement used to a specific value instead of setting it relative to its original value | ** '''set_movement_used''' {{DevFeature1.13|2}} like increase_movement_used, but sets the movement used to a specific value instead of setting it relative to its original value | ||
+ | ** '''set_attacks_used''' {{DevFeature1.17|13}} like increase_attacks_used, but sets the attacks used to a specific value instead of setting it relative to its original value | ||
** '''attack_weight''': change the attack's attack_weight. See [attack] in [[UnitTypeWML#Attacks|UnitTypeWML]] for explanations about attack_weight. | ** '''attack_weight''': change the attack's attack_weight. See [attack] in [[UnitTypeWML#Attacks|UnitTypeWML]] for explanations about attack_weight. | ||
** '''defense_weight''': change the attack's defense_weight. See [attack] in [[UnitTypeWML#Attacks|UnitTypeWML]] for explanations about defense_weight. | ** '''defense_weight''': change the attack's defense_weight. See [attack] in [[UnitTypeWML#Attacks|UnitTypeWML]] for explanations about defense_weight. | ||
− | * '''max_attacks''': {{DevFeature1.13|2}} change the unit's maximum attacks per turn | + | ** '''set_min_range''' {{DevFeature1.19|4}} modify required distance between units in order to allow using attack |
+ | ** '''set_max_range''' {{DevFeature1.19|4}} modify required distance between units in order to allow using attack | ||
+ | ** '''increase_min_range''' {{DevFeature1.19|4}} modify required distance between units in order to allow using attack | ||
+ | ** '''increase_max_range''' {{DevFeature1.19|4}} modify required distance between units in order to allow using attack | ||
+ | * {{anchor|apply_to-max_attacks|'''max_attacks'''}}: {{DevFeature1.13|2}} change the unit's maximum attacks per turn | ||
** '''increase''': how much to increase by; can be positive or negative, or a percentage | ** '''increase''': how much to increase by; can be positive or negative, or a percentage | ||
− | * '''hitpoints''': modifies the unit's HP and/or max HP. | + | * {{anchor|apply_to-hitpoints|'''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 will be put back to full 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. | ** '''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_maximum''': it the unit ends up with more than its max HP after these modifications, and this key is present (set to any non-null value, ex. '''yes'''), the unit's HP won't be lowered to its max HP. | ** '''violate_maximum''': it the unit ends up with more than its max HP after these modifications, and this key is present (set to any non-null value, ex. '''yes'''), the unit's HP won't be lowered to its max HP. | ||
− | * '''movement''': modifies the unit's movement points. | + | * {{anchor|apply_to-movement|'''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. | ** '''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. | ||
− | * '''vision''': {{DevFeature1.13|2}} modifies the unit's vision points. | + | ** '''apply_to_vision''': {{DevFeature1.15|13}} if set to '''yes''' (which is the default), then the vision points will change by the same amount. See [[#Movement_and_Vision|Movement and Vision]]. |
+ | * {{anchor|apply_to-vision|'''vision'''}}: {{DevFeature1.13|2}} modifies the unit's vision points. Note: this has side effects described in [[#Movement_and_Vision|Movement and Vision]]. | ||
** '''increase''': maximum vision is increased by this amount. It can be positive, negative, or specified as a percentage. | ** '''increase''': maximum vision is increased by this amount. It can be positive, negative, or specified as a percentage. | ||
− | ** '''set''': maximum vision is set to a specific value. | + | ** '''set''': maximum vision is set to a specific value. |
− | * '''jamming''': {{DevFeature1.13|2}} modifies the unit's jamming points. | + | * {{anchor|apply_to-jamming|'''jamming'''}}: {{DevFeature1.13|2}} modifies the unit's jamming points. |
** '''increase''': maximum jamming is increased by this amount. It can be positive, negative, or specified as a percentage. | ** '''increase''': maximum jamming is increased by this amount. It can be positive, negative, or specified as a percentage. | ||
** '''set''': maximum jamming is set to a specific value. | ** '''set''': maximum jamming is set to a specific value. | ||
− | * '''experience''': affects the unit's current XP. | + | * {{anchor|apply_to-experience|'''experience'''}}: affects the unit's current XP. |
** '''increase''': current XP is increased by this amount. It can be positive, negative, or specified as a percentage. | ** '''increase''': current XP is increased by this amount. It can be positive, negative, or specified as a percentage. | ||
** '''set''': current XP is set to a specific value. | ** '''set''': current XP is set to a specific value. | ||
− | * '''max_experience''': affects the amount of XP the unit needs for the next level. | + | * {{anchor|apply_to-max_experience|'''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. | ** '''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. | + | ** '''set''': current max XP is set to a specific value. |
− | * '''movement_costs''': speed through specific terrain is modified | + | * {{anchor|apply_to-loyal|'''loyal'''}}: no keys associated. The affected unit will be loyal i.e have an upkeep of 0. |
− | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values (negative values allowed). | + | * {{anchor|apply_to-fearless|'''fearless'''}}: Add/Remove fearless attribute. |
− | ** '''[movement_costs]''': a subtag that describes the new movement costs just like | + | ** '''set''': new value for fearless (boolean). Defaults to '''yes'''. |
− | * '''defense''': Sets the unit's chance to be hit in specific terrain (100 - the unit's defense as shown in-game). | + | * {{anchor|apply_to-healthy|'''healthy'''}}: Add/Remove healthy attribute. |
− | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values. In most cases, adding a positive number makes the unit easier to hit, while adding a negative number makes the unit harder to hit. The new value is added to the absolute value of the old, and the sign of the old value is preserved. | + | ** '''set''': new value for healthy (boolean). Defaults to '''yes'''. |
− | ** '''[defense]''': a subtag that describes the new defense just like | + | * {{anchor|apply_to_movement_costs|'''movement_costs'''}}: speed through specific terrain is modified |
− | * '''resistance''': Sets percent damage taken from combat (100 - the unit's resistance as shown in-game) | + | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values (negative values allowed). Defaults to '''no'''. |
− | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values. Adding a positive number makes the unit take more damage, while adding a negative number makes the unit take less damage. | + | ** '''[movement_costs]''': a subtag that describes the new movement costs just like under [[UnitsWML#.5Bmovetype.5D|[movetype]]] if replace is set to "yes" or the addition if "no". |
− | ** '''[resistance]''': a subtag that describes the new resistance just like | + | * {{anchor|apply_to-vision_costs|'''vision_costs'''}}: vision through specific terrain is modified |
− | * '''variation''': switches the unit into one of its variations. | + | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values (negative values allowed). Defaults to '''no'''. |
− | ** '''name''': the id of the variation to invoke. | + | ** '''[vision_costs]''': a subtag that describes the new vision costs just like under [[UnitsWML#.5Bmovetype.5D|[movetype]]] if replace is set to "yes" or the addition if "no". |
− | * '''type''': transforms the unit into a new unit_type. | + | * {{anchor|apply_to-jamming_costs|'''jamming_costs'''}}: jamming through specific terrain is modified |
+ | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values (negative values allowed). Defaults to '''no'''. | ||
+ | ** '''[jamming_costs]''': a subtag that describes the new jamming costs just like under [[UnitsWML#.5Bmovetype.5D|[movetype]]] if replace is set to "yes" or the addition if "no". | ||
+ | * {{anchor|apply_to-defense|'''defense'''}}: Sets the unit's chance to be hit in specific terrain (100 - the unit's defense as shown in-game). | ||
+ | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values. In most cases, adding a positive number makes the unit easier to hit, while adding a negative number makes the unit harder to hit. The new value is added to the absolute value of the old, and the sign of the old value is preserved. Defaults to '''no'''. | ||
+ | ** '''[defense]''': a subtag that describes the new defense just like under [[UnitsWML#.5Bmovetype.5D|[movetype]]] if replace is set to "yes" or the addition if "no". | ||
+ | * {{anchor|apply_to-resistance|'''resistance'''}}: Sets percent damage taken from combat (100 - the unit's resistance as shown in-game) | ||
+ | ** '''replace''': If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values. Adding a positive number makes the unit take more damage, while adding a negative number makes the unit take less damage. Defaults to '''no'''. | ||
+ | ** '''[resistance]''': a subtag that describes the new resistance just like under [[UnitsWML#.5Bmovetype.5D|[movetype]]] if replace is set to "yes" or the addition if "no". | ||
+ | * {{anchor|apply_to-variation|'''variation'''}}: switches the unit into one of its variations. Similar to the '''type''' effect below, this might not behave properly outside of [advancement]. | ||
+ | ** '''name''': the id of the variation to invoke. | ||
+ | * {{anchor|apply_to-type|'''type'''}}: transforms the unit into a new unit_type. This does not work in [trait]; in ActionWML it's recommended to use [transform_unit] instead of an [object] with this effect. This effect cannot be undone with [remove_object]. | ||
** '''name''': the id of the unit_type to invoke. | ** '''name''': the id of the unit_type to invoke. | ||
− | * '''status''': modifies the status affecting the unit. | + | * {{anchor|apply_to-status|'''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. These are listed in [status], [[SingleUnitWML]]. | ** '''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. | ||
− | * '''zoc''': toggle the zone of control. | + | * {{anchor|apply_to-zoc|'''zoc'''}}: toggle the zone of control. |
** '''value''': new value for zoc (boolean). | ** '''value''': new value for zoc (boolean). | ||
− | * '''profile''': customize the profile of the unit. See [[UnitTypeWML]]. | + | * {{anchor|apply_to-profile|'''profile'''}}: customize the profile of the unit. See [[UnitTypeWML]]. |
** '''portrait''': new image to display when the unit speaks. | ** '''portrait''': new image to display when the unit speaks. | ||
** '''small_portrait''': new image to display in unit reports. | ** '''small_portrait''': new image to display in unit reports. | ||
** '''description''': sets the text to display when hovering over the unit's type in the righthand pane. | ** '''description''': sets the text to display when hovering over the unit's type in the righthand pane. | ||
− | * '''new_ability''': Adds one or more abilities to a unit. | + | ** '''[special_note]''': {{DevFeature1.15|2}} Adds or removes a special note in the unit's description. |
+ | *** '''remove''': A boolean value specifying whether to add or remove a note. Defaults to '''no'''. | ||
+ | *** '''note''' (translatable): The text of the note you want to add or remove. If removing a note, this must be an exact match, character-for-character, for the note you want to remove, and must also be in the same textdomain. | ||
+ | *** Since the tag name is the same, notes can also be added using the standard special note macros, eg '''{NOTE_HEALS}'''. | ||
+ | *** To remove a note, you can simply suffix '''{NOTE_REMOVE}''' to the regular note macro, eg '''{NOTE_HEALS}{NOTE_REMOVE}'''. | ||
+ | * {{anchor|apply_to-new_ability|'''new_ability'''}}: Adds one or more abilities to a unit. | ||
** '''[abilities]''': A subtag that contains the ability definitions. | ** '''[abilities]''': A subtag that contains the ability definitions. | ||
− | * '''remove_ability''': Removes one or more abilities from a unit. Abilities are not reference counted | + | * '''remove_ability''': Removes one or more abilities from a unit. Abilities are not reference counted. Adding twice and removing once still means the ability is gone. |
− | ** '''[abilities]''': A subtag that contains the ability definitions. Strictly speaking, all that is needed is the id= inside some tag. | + | ** '''[abilities]''': A subtag that contains the ability definitions. Strictly speaking, all that is needed is the id= inside some tag. {{DevFeature1.17|17}} This is now deprecated, use [experimental_filter_ability] instead. |
− | * '''new_animation''': contain animations that will be added to the unit, it can contain multiple animation blocks, and a single "id=" line. That Id should be unique for each effect block and is used by the engine to reuse WML parsing, making the loading faster. | + | ** {{DevFeature1.17|17}} '''[experimental_filter_ability]''': [[StandardAbilityFilter]] to match the abilities to remove. |
− | * '''image_mod''': modify the image path function ([[ | + | * {{anchor|apply_to-new_animation|'''new_animation'''}}: contain animations that will be added to the unit, it can contain multiple animation blocks, and a single "id=" line. That Id should be unique for each effect block and is used by the engine to reuse WML parsing, making the loading faster. See [[AnimationWML]] for further reference. |
+ | * {{anchor|apply_to-image_mod|'''image_mod'''}}: modify the image path function ([[ImagePathFunctions]]) of all the unit's frames. Due to a bug, the effect is permanent even inside [object]duration=turn | ||
** '''replace''': replaces the image path function(s) to be used, e.g. "RC(magenta>red)" | ** '''replace''': replaces the image path function(s) to be used, e.g. "RC(magenta>red)" | ||
** '''add''': adds an image path function without removing any existing ones. | ** '''add''': adds an image path function without removing any existing ones. | ||
− | * '''ellipse''': Change the image used for the unit's ellipse. | + | ** If needed, you can also define new [[GameConfigWML#Color_Palettes|color palettes]] here. |
− | ** '''ellipse''' : the new image to use. | + | * {{anchor|apply_to-ellipse|'''ellipse'''}}: Change the image used for the unit's ellipse. |
− | * '''halo''': Change the image used for the unit's halo. | + | ** '''ellipse''' : the new image base path to use. Defaults to '''misc/ellipse'''. Can be set to '''none''' to disable the ellipse. An ellipse consist of a top and bottom part so by default in the simplest case the game will look for image files misc/ellipse-top.png and misc/ellipse-bottom.png. This can get further modified based on if the unit is a leader (can_recruit), does the unit emit a zone of control (ZoC) and/or is the unit selected. For a unit that is a leader, emits no ZoC and is currently selected the used files would then be misc/ellipse-leader-nozoc-selected-top.png and misc/ellipse-leader-nozoc-selected-bottom.png. |
+ | * {{anchor|apply_to-halp|'''halo'''}}: Change the image used for the unit's halo. | ||
** '''halo''': the new image to use. | ** '''halo''': the new image to use. | ||
− | * '''overlay''': Change the unit's overlays. | + | * {{anchor|apply_to-overlay|'''overlay'''}}: Change the unit's overlays. |
**'''add''': the specified overlay will be added to the unit's overlays. It can be a comma separated list with multiple overlays. ''Note: overlays added in this way cannot be removed by [remove_unit_overlay] until the effect's duration is over.'' | **'''add''': the specified overlay will be added to the unit's overlays. It can be a comma separated list with multiple overlays. ''Note: overlays added in this way cannot be removed by [remove_unit_overlay] until the effect's duration is over.'' | ||
**'''replace''': all the unit's overlays will be removed and replaced with the specified one. Again, it can be a comma separated list. ''Note: overlays replaced in this way cannot be modified by [unit_overlay] or [remove_unit_overlay] until the effect's duration is over.'' | **'''replace''': all the unit's overlays will be removed and replaced with the specified one. Again, it can be a comma separated list. ''Note: overlays replaced in this way cannot be modified by [unit_overlay] or [remove_unit_overlay] until the effect's duration is over.'' | ||
− | * '''recall_cost''': {{DevFeature1.13|2}} change a unit's recall cost | + | **'''remove''': {{DevFeature1.15|0}} the specified overlay will be removed from the unit's overlays. It can be a comma separated list with multiple overlays. |
+ | ** {{DevFeature1.15|0}} [unit_overlay] and [remove_unit_overlay] are now equivalent to adding a permanent object with this effect, after checking if the unit already has / already doesn't have the overlay (effects with temporary durations will cause false positives / false negatives in this check). | ||
+ | * {{anchor|apply_to-recall_cost|'''recall_cost'''}}: {{DevFeature1.13|2}} change a unit's recall cost | ||
** '''set''': set recall cost to a specific value, or a percentage of original value | ** '''set''': set recall cost to a specific value, or a percentage of original value | ||
** '''increase''': alter recall cost relative to original value; can be positive or negative, or a percentage | ** '''increase''': alter recall cost relative to original value; can be positive or negative, or a percentage | ||
− | * '''alignment''': {{DevFeature1.13|2}} change a unit's alignment | + | * {{anchor|apply_to-alignment|'''alignment'''}}: {{DevFeature1.13|2}} change a unit's alignment |
** '''set''': the new alignment (one of chaotic, lawful, neutral, liminal) | ** '''set''': the new alignment (one of chaotic, lawful, neutral, liminal) | ||
− | * '''new_advancement''': {{DevFeature1.13|2}} add new advancement choices to the unit | + | * {{anchor|apply_to-new_advancement|'''new_advancement'''}}: {{DevFeature1.13|2}} add new advancement choices to the unit |
** '''replace''': whether to replace existing advancement choices; if this key is set to yes, existing advancement choices are cleared only if you're adding a choice of the same type. (That is, unit type advancements are cleared only if you're adding a new unit advancement choice, and AMLA choices are cleared only if you're adding new AMLA choices.) | ** '''replace''': whether to replace existing advancement choices; if this key is set to yes, existing advancement choices are cleared only if you're adding a choice of the same type. (That is, unit type advancements are cleared only if you're adding a new unit advancement choice, and AMLA choices are cleared only if you're adding new AMLA choices.) | ||
** '''types''': a comma-separated list of additional unit types the unit can advance to. ('''Note:''' If using this, you probably want to include a filter to prevent the unit from being able to advance to this type once it has already done so.) | ** '''types''': a comma-separated list of additional unit types the unit can advance to. ('''Note:''' If using this, you probably want to include a filter to prevent the unit from being able to advance to this type once it has already done so.) | ||
** '''[advancement]''': an advancement choice to add, see [[UnitTypeWML#After_max_level_advancement_(AMLA)|AMLAs]]; you can have several of these tags to add multiple advancement choices at the same time. | ** '''[advancement]''': an advancement choice to add, see [[UnitTypeWML#After_max_level_advancement_(AMLA)|AMLAs]]; you can have several of these tags to add multiple advancement choices at the same time. | ||
− | * '''remove_advancement''': {{DevFeature1.13|2}} remove existing advancement choices from the unit | + | * {{anchor|apply_to-remove_advancement|'''remove_advancement'''}}: {{DevFeature1.13|2}} remove existing advancement choices from the unit |
** '''types''': a list of unit type advancements to remove as a possibility | ** '''types''': a list of unit type advancements to remove as a possibility | ||
** '''amlas''': a list of AMLA id attributes; any advancement possibility with the given id will be removed | ** '''amlas''': a list of AMLA id attributes; any advancement possibility with the given id will be removed | ||
+ | * {{anchor|apply_to-level|'''level'''}}: {{DevFeature1.17|15}} change a unit's level. '''Note:''' this key is incompatible with ''times=per level''; if this combination is used, the engine reports a warning and uses ''times=1'' as fallback value | ||
+ | ** '''set''': set level to a specific value; can be positive or negative, but not a percentage | ||
+ | ** '''increase''': alter level relative to original value; can be positive or negative, but not a percentage | ||
− | === Examples === | + | == Movement and Vision == |
− | == Effect: apply_to = new_animation == | + | |
+ | Wesnoth 1.14 introduced vision points; by default units have the same number of vision points as their max movement points. However, combining effects that change vision with effects that change movement had edge cases which were reworked in 1.16: | ||
+ | |||
+ | Consider a unit with 5 mp, and default vision: | ||
+ | * It has (effectively) 5 mp and 5 vp. | ||
+ | * After (mp + 1), it will have 6 mp and 6 vp. | ||
+ | * After (vp + 2), it will have 5 mp and 7 vp. | ||
+ | |||
+ | In 1.14, using an effect with apply_to=vision breaks the link between vision and movement: | ||
+ | * After (mp + 1) (vp + 2), it will have 6 mp and 8 vp. | ||
+ | * After (vp + 2) (mp + 1), it will have 6 mp and 7 vp. | ||
+ | |||
+ | {{DevFeature1.15|13}}, [effect]apply_to=movement has another attribute apply_to_vision, which defaults to true. With that change, the order that the effects are applied in doesn't matter: | ||
+ | * After (mp + 1) (vp + 2), it will have 6 mp and 8 vp. | ||
+ | * After (vp + 2) (mp + 1), it will have 6 mp and 8 vp. | ||
+ | |||
+ | Increasing movement by 50% increases vision by (50% of movement) not by (50% of vision). For a unit that started with 6 mp and 8 vp, the following effect would give it 9 mp and 11 vp. | ||
+ | [effect] | ||
+ | apply_to=movement | ||
+ | increase=50% | ||
+ | [/effect] | ||
+ | |||
+ | == Examples == | ||
+ | === Effect: apply_to = new_animation === | ||
This is the only way to change animations of units after they have been placed on the map. | This is the only way to change animations of units after they have been placed on the map. | ||
In this example, I add very simple idle animation (taken from Goblin Spearman) to the unit, which moves to hex (x=1, y=5). If you want something more complex, you need to check [[AnimationWML]] page. | In this example, I add very simple idle animation (taken from Goblin Spearman) to the unit, which moves to hex (x=1, y=5). If you want something more complex, you need to check [[AnimationWML]] page. | ||
Line 160: | Line 221: | ||
[/unstore_unit] | [/unstore_unit] | ||
[/event] | [/event] | ||
+ | |||
+ | == Where to Use Effects == | ||
+ | |||
+ | A collection of effects together makes up a "unit modification", which is encased in one of the three types of modification tags: '''[trait]''', '''[object]''', or '''[advancement]'''. Which tag to use depends on the goal of the modification. | ||
+ | |||
+ | * [[UnitsWML#.5Btrait.5D|Traits]] are shown in the unit details on the sidebar. They can be placed in a race or unit type to include the trait in the pool of random traits for that race or unit type, or they can be placed in the global [units] tag to add them to the global pool of random traits. (Note that this can cause out-of-sync errors in multiplayer.) | ||
+ | * [[UnitTypeWML#After_max_level_advancement_.28AMLA.29|Advancements]] are offered when a unit levels up. If a unit type has both modification advancements and regular advancements, the player can choose either each time they level up. | ||
+ | * [[DirectActionsWML#.5Bobject.5D|Objects]] are usually placed on the map or added by special events. They also have a built-in facility to automatically remove under certain conditions. | ||
+ | |||
+ | An effect can also be placed in '''[modify_unit]''' [[DirectActionsWML#.5Bmodify_unit.5D|ActionWML]] to apply it on-the-fly without keeping a record that it has been applied. This is mainly useful for effects that change transient properties such as current hitpoints or experience. An effect applied in this way is liable to be reverted when the unit is rebuilt in the future, for example when they level up or when an object is removed. | ||
== See Also == | == See Also == |
Latest revision as of 17:17, 3 November 2024
Contents
[effect]
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; however using an [object] with a limited duration to apply an [effect] will cause the unit to be rebuilt without the effect's effects when the duration expires.
The following keys and subtags are always recognized:
- [filter]: only apply this effect if the affected unit matches. See StandardUnitFilter for details.
- times: describes how many times the effect is applied. The default is to apply the effect once. Other possible value : "per level" which means that the effect is applied level times, where level is the unit level. (Version 1.13.5 and later only) Integers are now supported for times.
- apply_to: describes what the effect actually affects. New effect types can be added with LuaAPI/wesnoth#wesnoth.effects. Some examples can be seen in World Conquest.
[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 [attack] in UnitTypeWML.
- remove_attacks: remove the matching attacks. All tags from the attack filter construct will be used to match the attack; see FilterWML. Do not use a [filter] tag otherwise it will not work properly.
- 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 keys and tags can be used to modify the attack. Note: do not use a [filter] tag. Just put the keys you want to filter on inside the [effect] tag.
- set_name: change the attack's name (ie identifier).
- set_description: change the attack's description (ie displayed name).
- set_type: change the attack type. The standard values are blade, pierce, impact, fire, cold, and arcane.
- set_range: change the attack range. The standard values are ranged and melee.
- set_icon: change the attack's icon.
- [set_specials]: change the attack's specials. The specials to add are given exactly as in the [specials] tag.
- mode: if append, adds the given specials to the attack. If replace, replaces the existing specials with the given ones. Default replace.
- (Version 1.15.3 and later only) A deprecation warning is triggered unless the mode attribute is set, although the effect will still be replace. This is to allow the default to change in the 1.17.x series.
- mode: if append, adds the given specials to the attack. If replace, replaces the existing specials with the given ones. Default replace.
- remove_specials: remove the listed specials. The value of this key is the comma-separated list of the id of the specials to remove. This key is always evaluated before a [set_specials] tags in the same [effect]
- [remove_specials]: (Version 1.19.6 and later only) remove the listed specials. Use StandardAbilityFilter, special removed if matches. This tag is always evaluated before a [set_specials] tags in the same [effect]
- 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_accuracy: increases the attack accuracy; can be positive or negative, or a percentage
- increase_parry: increases the attack parry bonus; can be positive or negative, or a percentage
- increase_movement_used: (Version 1.13.2 and later only) increases the movement points used by the attack; can be positive or negative, or a percentage
- increase_attacks_used: (Version 1.17.13 and later only) increases the attack points used by the attack; can be positive or negative, or a percentage
- set_damage (Version 1.13.2 and later only) like increase_damage, but sets the damage to a specific value instead of setting it relative to its original value
- set_attacks (Version 1.13.2 and later only) like increase_attacks, but sets the attacks to a specific value instead of setting it relative to its original value
- set_accuracy (Version 1.13.2 and later only) like increase_accuracy, but sets the accuracy to a specific value instead of setting it relative to its original value
- set_parry (Version 1.13.2 and later only) like increase_parry, but sets the parry to a specific value instead of setting it relative to its original value
- set_movement_used (Version 1.13.2 and later only) like increase_movement_used, but sets the movement used to a specific value instead of setting it relative to its original value
- set_attacks_used (Version 1.17.13 and later only) like increase_attacks_used, but sets the attacks used to a specific value instead of setting it relative to its original value
- attack_weight: change the attack's attack_weight. See [attack] in UnitTypeWML for explanations about attack_weight.
- defense_weight: change the attack's defense_weight. See [attack] in UnitTypeWML for explanations about defense_weight.
- set_min_range (Version 1.19.4 and later only) modify required distance between units in order to allow using attack
- set_max_range (Version 1.19.4 and later only) modify required distance between units in order to allow using attack
- increase_min_range (Version 1.19.4 and later only) modify required distance between units in order to allow using attack
- increase_max_range (Version 1.19.4 and later only) modify required distance between units in order to allow using attack
- max_attacks: (Version 1.13.2 and later only) change the unit's maximum attacks per turn
- increase: how much to increase by; 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_maximum: it the unit ends up with more than its max HP after these modifications, and this key is present (set to any non-null value, ex. yes), 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.
- apply_to_vision: (Version 1.15.13 and later only) if set to yes (which is the default), then the vision points will change by the same amount. See Movement and Vision.
- vision: (Version 1.13.2 and later only) modifies the unit's vision points. Note: this has side effects described in Movement and Vision.
- increase: maximum vision is increased by this amount. It can be positive, negative, or specified as a percentage.
- set: maximum vision is set to a specific value.
- jamming: (Version 1.13.2 and later only) modifies the unit's jamming points.
- increase: maximum jamming is increased by this amount. It can be positive, negative, or specified as a percentage.
- set: maximum jamming is set to a specific value.
- experience: affects the unit's current XP.
- increase: current XP is increased by this amount. It can be positive, negative, or specified as a percentage.
- set: current XP 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.
- set: current max XP is set to a specific value.
- loyal: no keys associated. The affected unit will be loyal i.e have an upkeep of 0.
- fearless: Add/Remove fearless attribute.
- set: new value for fearless (boolean). Defaults to yes.
- healthy: Add/Remove healthy attribute.
- set: new value for healthy (boolean). Defaults to yes.
- movement_costs: speed through specific terrain is modified
- replace: If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values (negative values allowed). Defaults to no.
- [movement_costs]: a subtag that describes the new movement costs just like under [movetype] if replace is set to "yes" or the addition if "no".
- vision_costs: vision through specific terrain is modified
- replace: If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values (negative values allowed). Defaults to no.
- [vision_costs]: a subtag that describes the new vision costs just like under [movetype] if replace is set to "yes" or the addition if "no".
- jamming_costs: jamming through specific terrain is modified
- replace: If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values (negative values allowed). Defaults to no.
- [jamming_costs]: a subtag that describes the new jamming costs just like under [movetype] if replace is set to "yes" or the addition if "no".
- defense: Sets the unit's chance to be hit in specific terrain (100 - the unit's defense as shown in-game).
- replace: If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values. In most cases, adding a positive number makes the unit easier to hit, while adding a negative number makes the unit harder to hit. The new value is added to the absolute value of the old, and the sign of the old value is preserved. Defaults to no.
- [defense]: a subtag that describes the new defense just like under [movetype] if replace is set to "yes" or the addition if "no".
- resistance: Sets percent damage taken from combat (100 - the unit's resistance as shown in-game)
- replace: If set to "yes", any new values replace the old ones. Otherwise, new values are added to old values. Adding a positive number makes the unit take more damage, while adding a negative number makes the unit take less damage. Defaults to no.
- [resistance]: a subtag that describes the new resistance just like under [movetype] if replace is set to "yes" or the addition if "no".
- variation: switches the unit into one of its variations. Similar to the type effect below, this might not behave properly outside of [advancement].
- name: the id of the variation to invoke.
- type: transforms the unit into a new unit_type. This does not work in [trait]; in ActionWML it's recommended to use [transform_unit] instead of an [object] with this effect. This effect cannot be undone with [remove_object].
- name: the id of the unit_type to invoke.
- 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.
- zoc: toggle the zone of control.
- value: new value for zoc (boolean).
- profile: customize the profile of the unit. See UnitTypeWML.
- portrait: new image to display when the unit speaks.
- small_portrait: new image to display in unit reports.
- description: sets the text to display when hovering over the unit's type in the righthand pane.
- [special_note]: (Version 1.15.2 and later only) Adds or removes a special note in the unit's description.
- remove: A boolean value specifying whether to add or remove a note. Defaults to no.
- note (translatable): The text of the note you want to add or remove. If removing a note, this must be an exact match, character-for-character, for the note you want to remove, and must also be in the same textdomain.
- Since the tag name is the same, notes can also be added using the standard special note macros, eg {NOTE_HEALS}.
- To remove a note, you can simply suffix {NOTE_REMOVE} to the regular note macro, eg {NOTE_HEALS}{NOTE_REMOVE}.
- new_ability: Adds one or more abilities to a unit.
- [abilities]: A subtag that contains the ability definitions.
- remove_ability: Removes one or more abilities from a unit. Abilities are not reference counted. Adding twice and removing once still means the ability is gone.
- [abilities]: A subtag that contains the ability definitions. Strictly speaking, all that is needed is the id= inside some tag. (Version 1.17.17 and later only) This is now deprecated, use [experimental_filter_ability] instead.
- (Version 1.17.17 and later only) [experimental_filter_ability]: StandardAbilityFilter to match the abilities to remove.
- new_animation: contain animations that will be added to the unit, it can contain multiple animation blocks, and a single "id=" line. That Id should be unique for each effect block and is used by the engine to reuse WML parsing, making the loading faster. See AnimationWML for further reference.
- image_mod: modify the image path function (ImagePathFunctions) of all the unit's frames. Due to a bug, the effect is permanent even inside [object]duration=turn
- replace: replaces the image path function(s) to be used, e.g. "RC(magenta>red)"
- add: adds an image path function without removing any existing ones.
- If needed, you can also define new color palettes here.
- ellipse: Change the image used for the unit's ellipse.
- ellipse : the new image base path to use. Defaults to misc/ellipse. Can be set to none to disable the ellipse. An ellipse consist of a top and bottom part so by default in the simplest case the game will look for image files misc/ellipse-top.png and misc/ellipse-bottom.png. This can get further modified based on if the unit is a leader (can_recruit), does the unit emit a zone of control (ZoC) and/or is the unit selected. For a unit that is a leader, emits no ZoC and is currently selected the used files would then be misc/ellipse-leader-nozoc-selected-top.png and misc/ellipse-leader-nozoc-selected-bottom.png.
- halo: Change the image used for the unit's halo.
- halo: the new image to use.
- overlay: Change the unit's overlays.
- add: the specified overlay will be added to the unit's overlays. It can be a comma separated list with multiple overlays. Note: overlays added in this way cannot be removed by [remove_unit_overlay] until the effect's duration is over.
- replace: all the unit's overlays will be removed and replaced with the specified one. Again, it can be a comma separated list. Note: overlays replaced in this way cannot be modified by [unit_overlay] or [remove_unit_overlay] until the effect's duration is over.
- remove: (Version 1.15.0 and later only) the specified overlay will be removed from the unit's overlays. It can be a comma separated list with multiple overlays.
- (Version 1.15.0 and later only) [unit_overlay] and [remove_unit_overlay] are now equivalent to adding a permanent object with this effect, after checking if the unit already has / already doesn't have the overlay (effects with temporary durations will cause false positives / false negatives in this check).
- recall_cost: (Version 1.13.2 and later only) change a unit's recall cost
- set: set recall cost to a specific value, or a percentage of original value
- increase: alter recall cost relative to original value; can be positive or negative, or a percentage
- alignment: (Version 1.13.2 and later only) change a unit's alignment
- set: the new alignment (one of chaotic, lawful, neutral, liminal)
- new_advancement: (Version 1.13.2 and later only) add new advancement choices to the unit
- replace: whether to replace existing advancement choices; if this key is set to yes, existing advancement choices are cleared only if you're adding a choice of the same type. (That is, unit type advancements are cleared only if you're adding a new unit advancement choice, and AMLA choices are cleared only if you're adding new AMLA choices.)
- types: a comma-separated list of additional unit types the unit can advance to. (Note: If using this, you probably want to include a filter to prevent the unit from being able to advance to this type once it has already done so.)
- [advancement]: an advancement choice to add, see AMLAs; you can have several of these tags to add multiple advancement choices at the same time.
- remove_advancement: (Version 1.13.2 and later only) remove existing advancement choices from the unit
- types: a list of unit type advancements to remove as a possibility
- amlas: a list of AMLA id attributes; any advancement possibility with the given id will be removed
- level: (Version 1.17.15 and later only) change a unit's level. Note: this key is incompatible with times=per level; if this combination is used, the engine reports a warning and uses times=1 as fallback value
- set: set level to a specific value; can be positive or negative, but not a percentage
- increase: alter level relative to original value; can be positive or negative, but not a percentage
Movement and Vision
Wesnoth 1.14 introduced vision points; by default units have the same number of vision points as their max movement points. However, combining effects that change vision with effects that change movement had edge cases which were reworked in 1.16:
Consider a unit with 5 mp, and default vision:
- It has (effectively) 5 mp and 5 vp.
- After (mp + 1), it will have 6 mp and 6 vp.
- After (vp + 2), it will have 5 mp and 7 vp.
In 1.14, using an effect with apply_to=vision breaks the link between vision and movement:
- After (mp + 1) (vp + 2), it will have 6 mp and 8 vp.
- After (vp + 2) (mp + 1), it will have 6 mp and 7 vp.
(Version 1.15.13 and later only), [effect]apply_to=movement has another attribute apply_to_vision, which defaults to true. With that change, the order that the effects are applied in doesn't matter:
- After (mp + 1) (vp + 2), it will have 6 mp and 8 vp.
- After (vp + 2) (mp + 1), it will have 6 mp and 8 vp.
Increasing movement by 50% increases vision by (50% of movement) not by (50% of vision). For a unit that started with 6 mp and 8 vp, the following effect would give it 9 mp and 11 vp.
[effect] apply_to=movement increase=50% [/effect]
Examples
Effect: apply_to = new_animation
This is the only way to change animations of units after they have been placed on the map. In this example, I add very simple idle animation (taken from Goblin Spearman) to the unit, which moves to hex (x=1, y=5). If you want something more complex, you need to check AnimationWML page.
[event] name = moveto [filter] x,y = 1,5 [/filter] [object] [filter] x,y = 1,5 [/filter] [effect] apply_to = new_animation [idle_anim] {STANDARD_IDLE_FILTER} start_time=0 [frame] image="units/goblins/spearman-idle-[1~12].png:[150*3,300,150*8]" [/frame] [/idle_anim] [/effect] [/object] [/event]
If you are going to use advanced WML and want to add animation to unit, stored in variable, then following example might help you. This way is not efficient if you have no additional logic like inventoriy, shops, advanced unit modifications in your add-on. Is is preferred to use first variant or define all needed animation in unit_type.
[event] name = moveto [filter] x,y = 1,5 [/filter] [store_unit] [filter] x,y=1,5 [/filter] variable = stored_unit [/store_unit] [set_variables] name = stored_unit.modifications.object [value] [effect] apply_to = new_animation [idle_anim] {STANDARD_IDLE_FILTER} start_time=0 [frame] image="units/goblins/spearman-idle-[1~12].png:[150*3,300,150*8]" [/frame] [/idle_anim] [/effect] [/value] [/set_variables] [unstore_unit] variable = stored_unit [/unstore_unit] [/event]
Where to Use Effects
A collection of effects together makes up a "unit modification", which is encased in one of the three types of modification tags: [trait], [object], or [advancement]. Which tag to use depends on the goal of the modification.
- Traits are shown in the unit details on the sidebar. They can be placed in a race or unit type to include the trait in the pool of random traits for that race or unit type, or they can be placed in the global [units] tag to add them to the global pool of random traits. (Note that this can cause out-of-sync errors in multiplayer.)
- Advancements are offered when a unit levels up. If a unit type has both modification advancements and regular advancements, the player can choose either each time they level up.
- Objects are usually placed on the map or added by special events. They also have a built-in facility to automatically remove under certain conditions.
An effect can also be placed in [modify_unit] ActionWML to apply it on-the-fly without keeping a record that it has been applied. This is mainly useful for effects that change transient properties such as current hitpoints or experience. An effect applied in this way is liable to be reverted when the unit is rebuilt in the future, for example when they level up or when an object is removed.