https://wiki.wesnoth.org/api.php?action=feedcontributions&user=Floodbud&feedformat=atomThe Battle for Wesnoth Wiki - User contributions [en]2024-03-29T09:44:42ZUser contributionsMediaWiki 1.31.16https://wiki.wesnoth.org/index.php?title=UnitTypeWML&diff=18064UnitTypeWML2007-09-17T16:34:34Z<p>Floodbud: /* The [unit] tag */</p>
<hr />
<div>{{WML Tags}}<br />
== The [unit] tag ==<br />
<br />
Each '''[unit]''' tag defines one unit type. (for the use of [unit] to create a unit, see [[SingleUnitWML]])<br />
<br />
Unit animation syntax is described in [[AnimationWML]].<br />
<br />
The following key/tags are recognized:<br />
{| class="gallery" style="text-align:left;"<br />
|-<br />
! advancefrom<br />
| the previous level unit on the advancement tree<br />
- allows a campaign-specific unit to be spliced into an already existing advancement tree. It should generally be used only inside a campaign ifdef, to prevent changes to other campaigns. This tag makes changes to the ''advanceto'' and ''experience'' keys of a base unit to make it advance into this unit. It takes these keys:<br> ** ''unit'' the id of the base unit from which this unit advances. This adds the unit into the list of units which ''unit'' can advance into.<br>** [[experience]] is optional. If present and lower than the experience already required for the base unit to advance, then the experience to advance is lowered. Note: this will also lower the experience required to advance to other units which the base unit can advance into.<br />
|-<br />
! advanceto<br />
| When this unit has experience greater than or equal to [[experience]], it is replaced by a unit of the type that the value of [[advanceto]] refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! alignment<br />
| how the unit's damage should be affected by its lawful bonus (See [[TimeWML]]).<br />
|-<br />
! cost<br />
| when a player recruits a unit of this type, the player loses ''cost'' gold. If this would cause gold to drop below 0, the unit cannot be recruited.<br />
|-<br />
! experience<br />
| When this unit has experience greater than or equal to ''experience'', it is replaced by a unit with 0 experience of the type that the value of ''advanceto'' refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! gender<br />
| has a value of either ''male'' or ''female'', and determines which of the keys ''male_names'' and ''female_names'' should be read. When a unit of this type is recruited, it will be randomly assigned a name by the random name generator, which will use these names as a base.<br />
|-<br />
! hide_help<br />
| {{DevFeature}} determines if the unit type will appear in the in-game help. Possible values ''true'' and ''false'', defaults to ''false''.<br />
|-<br />
! hitpoints<br />
| the maximum HP that the unit has, and the HP it has when it is created.<br />
|-<br />
! id<br />
|the value of the ''type'' key for units of this type. An ''id'' should consist only of alphanumerics and spaces (or underscores). ''type'' keys are found in [[SingleUnitWML]] and [[FilterWML]]. For example, id=Drake Flare<br />
|-<br />
! level<br />
| the amount of upkeep the unit costs. After this unit fights, its opponent gains ''level'' experience. See also kill_experience ([[GameConfigWML]]), and leadership ([[AbilitiesWML]]).<br />
|-<br />
! movement<br />
| the number of move points that this unit recieves each turn.<br />
|-<br />
! movetype<br />
| See '''[[movetype]]''', [[UnitsWML]]. Note that the tags '''[[movement_costs]]''', '''[[defense]]''', and '''[[resistance]]''' can be used to modify this movetype.<br />
|-<br />
! name<br />
|(translatable) displayed in the Status Table for units of this type.<br />
|-<br />
! num_traits<br />
| the number of traits that units of this type should receive when they are recruited, overriding the value set in the [race] tag.<br />
|-<br />
! profile<br />
| the portrait image to use for this unit type. You can also set a portrait for an individual unit instead of the whole unit type (see [[SingleUnitWML]]).<br />
|-<br />
! race<br />
| See '''[race]''', [[UnitsWML]]. Also used in standard unit filter (see [[FilterWML]]).<br />
|-<br />
! unit_description<br />
| (translatable) the text displayed in the unit descriptor box for this unit. Default 'No description available...'.<br />
|-<br />
! undead_variation<br />
| Which image to use when a unit of this type is killed by a unit with the plague ability.<br />
|-<br />
! usage<br />
| the way that the AI should recruit this unit, as determined by the scenario designer. (See ''recruitment_pattern'', [[AiWML]]). The following are conventions on usage:<br> ** 'scout' Fast,<br> ** 'fighter' Melee fighter,<br> ** 'archer' Ranged fighter,<br> ** 'mixed fighter' Melee and ranged fighter, and<br> ** 'healer' Specialty 'heals' or 'cures'.<br />
|-<br />
! zoc<br />
| if "yes" the unit will have a zone of control regardless of level. If present but set to anything other than "yes," the unit will have no zone of control. If the tag is omitted, zone of control is dictated by unit level (level 0 = no zoc, level 1+ = has zoc).<br />
|}<br />
==== After max level advancement (AMLA) ====<br />
* '''[advancement]''' describes what happens to a unit when it reaches the XP required for advancement. It is considered as an advancement in the same way as advancement described by ''advanceto''; however, if the player chooses this advancement, the unit will have one or more effects applied to it instead of advancing.<br />
** ''id'' normal internationalization id.<br />
** ''description'' a description (see [[DescriptionWML]]) displayed as the option for this advancement if there is another advancement option that the player must choose from; otherwise, the advancement is chosen automatically and this key is irrelevant.<br />
** ''max_times'' default 1. The maximum times the unit can be awarded this advancement.<br />
** ''strict_amla'' (yes|no) default=no. Disable the AMLA if the unit can advance to another unit.<br />
** ''require_amla'' An optional list of AMLA ''id'' keys that act as prerequisites for this advancement to become available. Order is not important, and an AMLA id can be repeated any number of times to indicate that another advancement must be chosen several times before this advancement option will become available.<br />
*** example: ''require_amla=tough,tough,incr_damage'' assumes there exist other [advancement] options called ''id=tough'' and ''id=incr_damage''. Once ''tough'' is chosen twice and ''incr_damage'' is chosen once, then the current [advancement] will become available.<br />
*** ''require_amla=tough,incr_damage,tough'' is an equivalent way of expressing this.<br />
** '''[effect]''' A modification applied to the unit whenever this advancement is chosen. See [[EffectWML]]<br />
<br />
==== Other tags ====<br />
* '''[base_unit]''' Contains one attribute, '''id''', which must be the ID of a unit type. If specified, the UnitWML for that unit is copied into this one. Subsequent attributes modify the copy. (1.3.7 and later versions only.)<br />
* '''[attack]''' one of the unit's attacks.<br />
** ''description'' a translatable text for name of the attack, to be displayed to the user.<br />
** ''name'' the name of the attack. Used as a default description, if ''description'' is not present, and to determine the default icon, if ''icon'' is not present (if ''name=x'' then ''icon=attacks/x.png'' is assumed unless present). Non-translatable. Used for the ''has_weapon'' key; see [[FilterWML]]<br />
** ''type'' the damage type of the attack. Used in determining resistance to this attack (see '''[resistances]''', [[UnitsWML]]). Possible values are 'blade', 'pierce', 'impact', 'fire', 'cold', and 'holy'.<br />
** ''special'' the special ability of the attack. Currently having more than 1 ability is not supported. See [[AbilitiesWML]] for a list of possible values.<br />
** ''icon'' the image to use as an icon for the attack in the attack choice menu, as a path relative to the images directory.<br />
** ''range'' the range of the attack. Used to determine the enemy's retaliation, which will be of the same type. Also displayed on the status table in parentheses; 'melee'(default) displays "melee", while 'ranged' displays "ranged". Range can be anything. Standard values are now "melee" and "ranged". From now on, ''short'' and ''long'' will be treated as totally different ranges. You can create any number of ranges now (with any name), and units can only retaliate against attacks for which they have a corresponding attack of the same range. This value is translatable.<br />
** ''damage'' the damage of this attack<br />
** ''number'' the number of strikes per attack this weapon has<br />
For those two following settings, the engine usually chooses the attack with the best average total damages * weight (default weight = 1.0).<br />
** ''attack_weight'' helps the AI to choose which attack to use when attacking; highly weighted attacks are more likely to be used. Setting it to 0 disables the attack on attack<br />
** ''defense_weight'' used to determine which attack is used for retaliation. This affects gameplay, as the player is not allowed to determine his unit's retaliation weapon. Setting it to 0 disable the attacks on defense <br />
<br />
** '''[animation]'''<br />
:: This describes an animation for this attack. If multiple animations are present, one will be randomly chosen each time the unit attacks. See [[AnimationWML]] for possible keys.<br />
<br />
* '''[defend]''' See [[AnimationWML]]<br />
* '''[death]''' See [[AnimationWML]]<br />
* '''[teleport_anim]''' See [[AnimationWML]]<br />
* '''[extra_anim]''' See [[AnimationWML]]<br />
* '''[event]''' Any [event] written inside the [unit] tag will get included into any scenario where a unit of this type appears in. Note that such events get included when a unit of this type first appears in the scenario, not automatically when the scenario begins (meaning that ''name=prestart'' events, for example, would usually never trigger). See [[EventWML]] and [[WML_Abilities]]<br />
<br />
* '''[variation]''' Defines a variation of a unit. Variations are invoked with an [effect] tag. They are currently used for graphical variations (giving character sprites new weapons) but theoretically you could do anything with it.<br />
** ''variation_name'' The name of the variation.<br />
** ''inherit'' if ''yes'', inherits all the properties of the base unit.<br />
: All other keys in '''[variation]''' are the same as for '''[unit]''' itself.<br />
<br />
* '''[male]''', '''[female]''' They can contain all '''[unit]''' tags, to specify a variation of different gender for a unit.<br />
<br />
* '''[abilities]''' Defines the abilities of a unit. See [[AbilitiesWML]]<br />
<br />
== See Also ==<br />
<br />
* [[AnimationWML]]<br />
* [[ReferenceWML]]<br />
* [[TerrainWML]]<br />
<br />
<br />
[[Category: WML Reference]]</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=UnitTypeWML&diff=17901UnitTypeWML2007-09-10T17:47:34Z<p>Floodbud: /* The [unit] tag */</p>
<hr />
<div>{{WML Tags}}<br />
== The [unit] tag ==<br />
<br />
Each '''[unit]''' tag defines one unit type. (for the use of [unit] to create a unit, see [[SingleUnitWML]])<br />
<br />
Unit animation syntax is described in [[AnimationWML]].<br />
<br />
The following key/tags are recognized:<br />
{| class="gallery" style="text-align:left;"<br />
|-<br />
! [[advancefrom]]<br />
| the previous level unit on the advancement tree<br />
- allows a campaign-specific unit to be spliced into an already existing advancement tree. It should generally be used only inside a campaign ifdef, to prevent changes to other campaigns. This tag makes changes to the ''advanceto'' and ''experience'' keys of a base unit to make it advance into this unit. It takes these keys:<br> ** ''unit'' the id of the base unit from which this unit advances. This adds the unit into the list of units which ''unit'' can advance into.<br>** [[experience]] is optional. If present and lower than the experience already required for the base unit to advance, then the experience to advance is lowered. Note: this will also lower the experience required to advance to other units which the base unit can advance into.<br />
|-<br />
! [[advanceto]]<br />
| When this unit has experience greater than or equal to [[experience]], it is replaced by a unit with 0 experience of the type that the value of [[advanceto]] refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! alignment<br />
| how the unit's damage should be affected by its lawful bonus (See [[TimeWML]]).<br />
|-<br />
! cost<br />
| when a player recruits a unit of this type, the player loses ''cost'' gold. If this would cause gold to drop below 0, the unit cannot be recruited.<br />
|-<br />
! experience<br />
| When this unit has experience greater than or equal to ''experience'', it is replaced by a unit with 0 experience of the type that the value of ''advanceto'' refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! gender<br />
| has a value of either ''male'' or ''female'', and determines which of the keys ''male_names'' and ''female_names'' should be read. When a unit of this type is recruited, it will be randomly assigned a name by the random name generator, which will use these names as a base.<br />
|-<br />
! hide_help<br />
| {{DevFeature}} determines if the unit type will appear in the in-game help. Possible values ''true'' and ''false'', defaults to ''false''.<br />
|-<br />
! hitpoints<br />
| the maximum HP that the unit has, and the HP it has when it is created.<br />
|-<br />
! id<br />
|the value of the ''type'' key for units of this type. An ''id'' should consist only of alphanumerics and underscores. ''type'' keys are found in [[SingleUnitWML]] and [[FilterWML]]. For example, an id could be "drake flare", "1_Rooting_Out_A_Mage", or any other descriptive name. id, and not file name, is used to refer to something in code.<br />
|-<br />
! level<br />
| the amount of upkeep the unit costs. After this unit fights, its opponent gains ''level'' experience. See also kill_experience ([[GameConfigWML]]), and leadership ([[AbilitiesWML]]).<br />
|-<br />
! movement<br />
| the number of move points that this unit recieves each turn.<br />
|-<br />
! movetype<br />
| See '''[[movetype]]''', [[UnitsWML]]. Note that the tags '''[[movement_costs]]''', '''[[defense]]''', and '''[[resistance]]''' can be used to modify this movetype.<br />
|-<br />
! name<br />
|(translatable) displayed in the Status Table for units of this type.<br />
|-<br />
! num_traits<br />
| the number of traits that units of this type should receive when they are recruited, overriding the value set in the [race] tag.<br />
|-<br />
! profile<br />
| the portrait image to use for this unit type. You can also set a portrait for an individual unit instead of the whole unit type (see [[SingleUnitWML]]).<br />
|-<br />
! race<br />
| See '''[race]''', [[UnitsWML]]. Also used in standard unit filter (see [[FilterWML]]).<br />
|-<br />
! unit_description<br />
| (translatable) the text displayed in the unit descriptor box for this unit. Default 'No description available...'.<br />
|-<br />
! undead_variation<br />
| Which image to use when a unit of this type is killed by a unit with the plague ability.<br />
|-<br />
! usage<br />
| the way that the AI should recruit this unit, as determined by the scenario designer. (See ''recruitment_pattern'', [[AiWML]]). The following are conventions on usage:<br> ** 'scout' Fast,<br> ** 'fighter' Melee fighter,<br> ** 'archer' Ranged fighter,<br> ** 'mixed fighter' Melee and ranged fighter, and<br> ** 'healer' Specialty 'heals' or 'cures'.<br />
|-<br />
! zoc<br />
| if "yes" the unit will have a zone of control regardless of level. If present but set to anything other than "yes," the unit will have no zone of control. If the tag is omitted, zone of control is dictated by unit level (level 0 = no zoc, level 1+ = has zoc).<br />
|}<br />
==== After max level advancement (AMLA) ====<br />
* '''[advancement]''' describes what happens to a unit when it reaches the XP required for advancement. It is considered as an advancement in the same way as advancement described by ''advanceto''; however, if the player chooses this advancement, the unit will have one or more effects applied to it instead of advancing.<br />
** ''id'' normal internationalization id.<br />
** ''description'' a description (see [[DescriptionWML]]) displayed as the option for this advancement if there is another advancement option that the player must choose from; otherwise, the advancement is chosen automatically and this key is irrelevant.<br />
** ''max_times'' default 1. The maximum times the unit can be awarded this advancement.<br />
** ''strict_amla'' (yes|no) default=no. Disable the AMLA if the unit can advance to another unit.<br />
** ''require_amla'' An optional list of AMLA ''id'' keys that act as prerequisites for this advancement to become available. Order is not important, and an AMLA id can be repeated any number of times to indicate that another advancement must be chosen several times before this advancement option will become available.<br />
*** example: ''require_amla=tough,tough,incr_damage'' assumes there exist other [advancement] options called ''id=tough'' and ''id=incr_damage''. Once ''tough'' is chosen twice and ''incr_damage'' is chosen once, then the current [advancement] will become available.<br />
*** ''require_amla=tough,incr_damage,tough'' is an equivalent way of expressing this.<br />
** '''[effect]''' A modification applied to the unit whenever this advancement is chosen. See [[EffectWML]]<br />
<br />
==== Other tags ====<br />
* '''[base_unit]''' Contains one attribute, '''id''', which must be the ID of a unit type. If specified, the UnitWML for that unit is copied into this one. Subsequent attributes modify the copy. (1.3.7 and later versions only.)<br />
* '''[attack]''' one of the unit's attacks.<br />
** ''description'' a translatable text for name of the attack, to be displayed to the user.<br />
** ''name'' the name of the attack. Used as a default description, if ''description'' is not present, and to determine the default icon, if ''icon'' is not present (if ''name=x'' then ''icon=attacks/x.png'' is assumed unless present). Non-translatable. Used for the ''has_weapon'' key; see [[FilterWML]]<br />
** ''type'' the damage type of the attack. Used in determining resistance to this attack (see '''[resistances]''', [[UnitsWML]]). Possible values are 'blade', 'pierce', 'impact', 'fire', 'cold', and 'holy'.<br />
** ''special'' the special ability of the attack. Currently having more than 1 ability is not supported. See [[AbilitiesWML]] for a list of possible values.<br />
** ''icon'' the image to use as an icon for the attack in the attack choice menu, as a path relative to the images directory.<br />
** ''range'' the range of the attack. Used to determine the enemy's retaliation, which will be of the same type. Also displayed on the status table in parentheses; 'melee'(default) displays "melee", while 'ranged' displays "ranged". Range can be anything. Standard values are now "melee" and "ranged". From now on, ''short'' and ''long'' will be treated as totally different ranges. You can create any number of ranges now (with any name), and units can only retaliate against attacks for which they have a corresponding attack of the same range. This value is translatable.<br />
** ''damage'' the damage of this attack<br />
** ''number'' the number of strikes per attack this weapon has<br />
For those two following settings, the engine usually chooses the attack with the best average total damages * weight (default weight = 1.0).<br />
** ''attack_weight'' helps the AI to choose which attack to use when attacking; highly weighted attacks are more likely to be used. Setting it to 0 disables the attack on attack<br />
** ''defense_weight'' used to determine which attack is used for retaliation. This affects gameplay, as the player is not allowed to determine his unit's retaliation weapon. Setting it to 0 disable the attacks on defense <br />
<br />
** '''[animation]'''<br />
:: This describes an animation for this attack. If multiple animations are present, one will be randomly chosen each time the unit attacks. See [[AnimationWML]] for possible keys.<br />
<br />
* '''[defend]''' See [[AnimationWML]]<br />
* '''[death]''' See [[AnimationWML]]<br />
* '''[teleport_anim]''' See [[AnimationWML]]<br />
* '''[extra_anim]''' See [[AnimationWML]]<br />
* '''[event]''' Any [event] written inside the [unit] tag will get included into any scenario where a unit of this type appears in. Note that such events get included when a unit of this type first appears in the scenario, not automatically when the scenario begins (meaning that ''name=prestart'' events, for example, would usually never trigger). See [[EventWML]] and [[WML_Abilities]]<br />
<br />
* '''[variation]''' Defines a variation of a unit. Variations are invoked with an [effect] tag. They are currently used for graphical variations (giving character sprites new weapons) but theoretically you could do anything with it.<br />
** ''variation_name'' The name of the variation.<br />
** ''inherit'' if ''yes'', inherits all the properties of the base unit.<br />
: All other keys in '''[variation]''' are the same as for '''[unit]''' itself.<br />
<br />
* '''[male]''', '''[female]''' They can contain all '''[unit]''' tags, to specify a variation of different gender for a unit.<br />
<br />
* '''[abilities]''' Defines the abilities of a unit. See [[AbilitiesWML]]<br />
<br />
== See Also ==<br />
<br />
* [[AnimationWML]]<br />
* [[ReferenceWML]]<br />
* [[TerrainWML]]<br />
<br />
<br />
[[Category: WML Reference]]</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=UnitTypeWML&diff=17781UnitTypeWML2007-09-05T15:52:13Z<p>Floodbud: /* The [unit] tag */</p>
<hr />
<div>{{WML Tags}}<br />
== The [unit] tag ==<br />
<br />
Each '''[unit]''' tag defines one unit type. (for the use of [unit] to create a unit, see [[SingleUnitWML]])<br />
<br />
Unit animation syntax is described in [[AnimationWML]].<br />
<br />
The following key/tags are recognized:<br />
{| class="gallery" style="text-align:left;"<br />
|-<br />
! [[advancefrom]]<br />
| the previous level unit on the advancement tree<br />
- allows a campaign-specific unit to be spliced into an already existing advancement tree. It should generally be used only inside a campaign ifdef, to prevent changes to other campaigns. This tag makes changes to the ''advanceto'' and ''experience'' keys of a base unit to make it advance into this unit. It takes these keys:<br> ** ''unit'' the id of the base unit from which this unit advances. This adds the unit into the list of units which ''unit'' can advance into.<br>** [[experience]] is optional. If present and lower than the experience already required for the base unit to advance, then the experience to advance is lowered. Note: this will also lower the experience required to advance to other units which the base unit can advance into.<br />
|-<br />
! [[advanceto]]<br />
| When this unit has experience greater than or equal to [[experience]], it is replaced by a unit with 0 experience of the type that the value of [[advanceto]] refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! alignment<br />
| how the unit's damage should be affected by its lawful bonus (See [[TimeWML]]).<br />
|-<br />
! cost<br />
| when a player recruits a unit of this type, the player loses ''cost'' gold. If this would cause gold to drop below 0, the unit cannot be recruited.<br />
|-<br />
! experience<br />
| When this unit has experience greater than or equal to ''experience'', it is replaced by a unit with 0 experience of the type that the value of ''advanceto'' refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! gender<br />
| has a value of either ''male'' or ''female'', and determines which of the keys ''male_names'' and ''female_names'' should be read. When a unit of this type is recruited, it will be randomly assigned a name by the random name generator, which will use these names as a base.<br />
|-<br />
! hide_help<br />
| {{DevFeature}} determines if the unit type will appear in the in-game help. Possible values ''true'' and ''false'', defaults to ''false''.<br />
|-<br />
! hitpoints<br />
| the maximum HP that the unit has, and the HP it has when it is created.<br />
|-<br />
! id<br />
|the value of the ''type'' key for units of this type. An ''id'' should consist only of alphanumerics and underscores. ''type'' keys are found in [[SingleUnitWML]] and [[FilterWML]].<br />
|-<br />
! level<br />
| the amount of upkeep the unit costs. After this unit fights, its opponent gains ''level'' experience. See also kill_experience ([[GameConfigWML]]), and leadership ([[AbilitiesWML]]).<br />
|-<br />
! movement<br />
| the number of move points that this unit recieves each turn.<br />
|-<br />
! movetype<br />
| See '''[[movetype]]''', [[UnitsWML]]. Note that the tags '''[[movement_costs]]''', '''[[defense]]''', and '''[[resistance]]''' can be used to modify this movetype.<br />
|-<br />
! name<br />
|(translatable) displayed in the Status Table for units of this type.<br />
|-<br />
! num_traits<br />
| the number of traits that units of this type should receive when they are recruited, overriding the value set in the [race] tag.<br />
|-<br />
! profile<br />
| the portrait image to use for this unit type. You can also set a portrait for an individual unit instead of the whole unit type (see [[SingleUnitWML]]).<br />
|-<br />
! race<br />
| See '''[race]''', [[UnitsWML]]. Also used in standard unit filter (see [[FilterWML]]).<br />
|-<br />
! unit_description<br />
| (translatable) the text displayed in the unit descriptor box for this unit. Default 'No description available...'.<br />
|-<br />
! undead_variation<br />
| Which image to use when a unit of this type is killed by a unit with the plague ability.<br />
|-<br />
! usage<br />
| the way that the AI should recruit this unit, as determined by the scenario designer. (See ''recruitment_pattern'', [[AiWML]]). The following are conventions on usage:<br> ** 'scout' Fast,<br> ** 'fighter' Melee fighter,<br> ** 'archer' Ranged fighter,<br> ** 'mixed fighter' Melee and ranged fighter, and<br> ** 'healer' Specialty 'heals' or 'cures'.<br />
|-<br />
! zoc<br />
| if "yes" the unit will have a zone of control regardless of level. If present but set to anything other than "yes," the unit will have no zone of control. If the tag is omitted, zone of control is dictated by unit level (level 0 = no zoc, level 1+ = has zoc).<br />
|}<br />
==== After max level advancement (AMLA) ====<br />
* '''[advancement]''' describes what happens to a unit when it reaches the XP required for advancement. It is considered as an advancement in the same way as advancement described by ''advanceto''; however, if the player chooses this advancement, the unit will have one or more effects applied to it instead of advancing.<br />
** ''id'' normal internationalization id.<br />
** ''description'' a description (see [[DescriptionWML]]) displayed as the option for this advancement if there is another advancement option that the player must choose from; otherwise, the advancement is chosen automatically and this key is irrelevant.<br />
** ''max_times'' default 1. The maximum times the unit can be awarded this advancement.<br />
** ''strict_amla'' (yes|no) default=no. Disable the AMLA if the unit can advance to another unit.<br />
** ''require_amla'' An optional list of AMLA ''id'' keys that act as prerequisites for this advancement to become available. Order is not important, and an AMLA id can be repeated any number of times to indicate that another advancement must be chosen several times before this advancement option will become available.<br />
*** example: ''require_amla=tough,tough,incr_damage'' assumes there exist other [advancement] options called ''id=tough'' and ''id=incr_damage''. Once ''tough'' is chosen twice and ''incr_damage'' is chosen once, then the current [advancement] will become available.<br />
*** ''require_amla=tough,incr_damage,tough'' is an equivalent way of expressing this.<br />
** '''[effect]''' A modification applied to the unit whenever this advancement is chosen. See [[EffectWML]]<br />
<br />
==== Other tags ====<br />
* '''[base_unit]''' Contains one attribute, '''id''', which must be the ID of a unit type. If specified, the UnitWML for that unit is copied into this one. Subsequent attributes modify the copy. (1.3.7 and later versions only.)<br />
* '''[attack]''' one of the unit's attacks.<br />
** ''description'' a translatable text for name of the attack, to be displayed to the user.<br />
** ''name'' the name of the attack. Used as a default description, if ''description'' is not present, and to determine the default icon, if ''icon'' is not present (if ''name=x'' then ''icon=attacks/x.png'' is assumed unless present). Non-translatable. Used for the ''has_weapon'' key; see [[FilterWML]]<br />
** ''type'' the damage type of the attack. Used in determining resistance to this attack (see '''[resistances]''', [[UnitsWML]]). Possible values are 'blade', 'pierce', 'impact', 'fire', 'cold', and 'holy'.<br />
** ''special'' the special ability of the attack. Currently having more than 1 ability is not supported. See [[AbilitiesWML]] for a list of possible values.<br />
** ''icon'' the image to use as an icon for the attack in the attack choice menu, as a path relative to the images directory.<br />
** ''range'' the range of the attack. Used to determine the enemy's retaliation, which will be of the same type. Also displayed on the status table in parentheses; 'melee'(default) displays "melee", while 'ranged' displays "ranged". Range can be anything. Standard values are now "melee" and "ranged". From now on, ''short'' and ''long'' will be treated as totally different ranges. You can create any number of ranges now (with any name), and units can only retaliate against attacks for which they have a corresponding attack of the same range. This value is translatable.<br />
** ''damage'' the damage of this attack<br />
** ''number'' the number of strikes per attack this weapon has<br />
For those two following settings, the engine usually chooses the attack with the best average total damages * weight (default weight = 1.0).<br />
** ''attack_weight'' helps the AI to choose which attack to use when attacking; highly weighted attacks are more likely to be used. Setting it to 0 disables the attack on attack<br />
** ''defense_weight'' used to determine which attack is used for retaliation. This affects gameplay, as the player is not allowed to determine his unit's retaliation weapon. Setting it to 0 disable the attacks on defense <br />
<br />
** '''[animation]'''<br />
:: This describes an animation for this attack. If multiple animations are present, one will be randomly chosen each time the unit attacks. See [[AnimationWML]] for possible keys.<br />
<br />
* '''[defend]''' See [[AnimationWML]]<br />
* '''[death]''' See [[AnimationWML]]<br />
* '''[teleport_anim]''' See [[AnimationWML]]<br />
* '''[extra_anim]''' See [[AnimationWML]]<br />
* '''[event]''' Any [event] written inside the [unit] tag will get included into any scenario where a unit of this type appears in. Note that such events get included when a unit of this type first appears in the scenario, not automatically when the scenario begins (meaning that ''name=prestart'' events, for example, would usually never trigger). See [[EventWML]] and [[WML_Abilities]]<br />
<br />
* '''[variation]''' Defines a variation of a unit. Variations are invoked with an [effect] tag. They are currently used for graphical variations (giving character sprites new weapons) but theoretically you could do anything with it.<br />
** ''variation_name'' The name of the variation.<br />
** ''inherit'' if ''yes'', inherits all the properties of the base unit.<br />
: All other keys in '''[variation]''' are the same as for '''[unit]''' itself.<br />
<br />
* '''[male]''', '''[female]''' They can contain all '''[unit]''' tags, to specify a variation of different gender for a unit.<br />
<br />
* '''[abilities]''' Defines the abilities of a unit. See [[AbilitiesWML]]<br />
<br />
== See Also ==<br />
<br />
* [[AnimationWML]]<br />
* [[ReferenceWML]]<br />
* [[TerrainWML]]<br />
<br />
<br />
[[Category: WML Reference]]</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=UnitTypeWML&diff=17780UnitTypeWML2007-09-05T15:51:27Z<p>Floodbud: /* The [unit] tag */</p>
<hr />
<div>{{WML Tags}}<br />
== The [unit] tag ==<br />
<br />
Each '''[unit]''' tag defines one unit type. (for the use of [unit] to create a unit, see [[SingleUnitWML]])<br />
<br />
Unit animation syntax is described in [[AnimationWML]].<br />
<br />
The following key/tags are recognized:<br />
{| class="gallery" style="text-align:left;"<br />
|-<br />
! [[advancefrom]]<br />
| what the unit becomes when it gains enough experience to level up<br />
- allows a campaign-specific unit to be spliced into an already existing advancement tree. It should generally be used only inside a campaign ifdef, to prevent changes to other campaigns. This tag makes changes to the ''advanceto'' and ''experience'' keys of a base unit to make it advance into this unit. It takes these keys:<br> ** ''unit'' the id of the base unit from which this unit advances. This adds the unit into the list of units which ''unit'' can advance into.<br>** [[experience]] is optional. If present and lower than the experience already required for the base unit to advance, then the experience to advance is lowered. Note: this will also lower the experience required to advance to other units which the base unit can advance into.<br />
|-<br />
! [[advanceto]]<br />
| When this unit has experience greater than or equal to [[experience]], it is replaced by a unit with 0 experience of the type that the value of [[advanceto]] refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! alignment<br />
| how the unit's damage should be affected by its lawful bonus (See [[TimeWML]]).<br />
|-<br />
! cost<br />
| when a player recruits a unit of this type, the player loses ''cost'' gold. If this would cause gold to drop below 0, the unit cannot be recruited.<br />
|-<br />
! experience<br />
| When this unit has experience greater than or equal to ''experience'', it is replaced by a unit with 0 experience of the type that the value of ''advanceto'' refers to. All modifications that have been done to the unit are applied to the unit it is replaced by.<br />
|-<br />
! gender<br />
| has a value of either ''male'' or ''female'', and determines which of the keys ''male_names'' and ''female_names'' should be read. When a unit of this type is recruited, it will be randomly assigned a name by the random name generator, which will use these names as a base.<br />
|-<br />
! hide_help<br />
| {{DevFeature}} determines if the unit type will appear in the in-game help. Possible values ''true'' and ''false'', defaults to ''false''.<br />
|-<br />
! hitpoints<br />
| the maximum HP that the unit has, and the HP it has when it is created.<br />
|-<br />
! id<br />
|the value of the ''type'' key for units of this type. An ''id'' should consist only of alphanumerics and underscores. ''type'' keys are found in [[SingleUnitWML]] and [[FilterWML]].<br />
|-<br />
! level<br />
| the amount of upkeep the unit costs. After this unit fights, its opponent gains ''level'' experience. See also kill_experience ([[GameConfigWML]]), and leadership ([[AbilitiesWML]]).<br />
|-<br />
! movement<br />
| the number of move points that this unit recieves each turn.<br />
|-<br />
! movetype<br />
| See '''[[movetype]]''', [[UnitsWML]]. Note that the tags '''[[movement_costs]]''', '''[[defense]]''', and '''[[resistance]]''' can be used to modify this movetype.<br />
|-<br />
! name<br />
|(translatable) displayed in the Status Table for units of this type.<br />
|-<br />
! num_traits<br />
| the number of traits that units of this type should receive when they are recruited, overriding the value set in the [race] tag.<br />
|-<br />
! profile<br />
| the portrait image to use for this unit type. You can also set a portrait for an individual unit instead of the whole unit type (see [[SingleUnitWML]]).<br />
|-<br />
! race<br />
| See '''[race]''', [[UnitsWML]]. Also used in standard unit filter (see [[FilterWML]]).<br />
|-<br />
! unit_description<br />
| (translatable) the text displayed in the unit descriptor box for this unit. Default 'No description available...'.<br />
|-<br />
! undead_variation<br />
| Which image to use when a unit of this type is killed by a unit with the plague ability.<br />
|-<br />
! usage<br />
| the way that the AI should recruit this unit, as determined by the scenario designer. (See ''recruitment_pattern'', [[AiWML]]). The following are conventions on usage:<br> ** 'scout' Fast,<br> ** 'fighter' Melee fighter,<br> ** 'archer' Ranged fighter,<br> ** 'mixed fighter' Melee and ranged fighter, and<br> ** 'healer' Specialty 'heals' or 'cures'.<br />
|-<br />
! zoc<br />
| if "yes" the unit will have a zone of control regardless of level. If present but set to anything other than "yes," the unit will have no zone of control. If the tag is omitted, zone of control is dictated by unit level (level 0 = no zoc, level 1+ = has zoc).<br />
|}<br />
==== After max level advancement (AMLA) ====<br />
* '''[advancement]''' describes what happens to a unit when it reaches the XP required for advancement. It is considered as an advancement in the same way as advancement described by ''advanceto''; however, if the player chooses this advancement, the unit will have one or more effects applied to it instead of advancing.<br />
** ''id'' normal internationalization id.<br />
** ''description'' a description (see [[DescriptionWML]]) displayed as the option for this advancement if there is another advancement option that the player must choose from; otherwise, the advancement is chosen automatically and this key is irrelevant.<br />
** ''max_times'' default 1. The maximum times the unit can be awarded this advancement.<br />
** ''strict_amla'' (yes|no) default=no. Disable the AMLA if the unit can advance to another unit.<br />
** ''require_amla'' An optional list of AMLA ''id'' keys that act as prerequisites for this advancement to become available. Order is not important, and an AMLA id can be repeated any number of times to indicate that another advancement must be chosen several times before this advancement option will become available.<br />
*** example: ''require_amla=tough,tough,incr_damage'' assumes there exist other [advancement] options called ''id=tough'' and ''id=incr_damage''. Once ''tough'' is chosen twice and ''incr_damage'' is chosen once, then the current [advancement] will become available.<br />
*** ''require_amla=tough,incr_damage,tough'' is an equivalent way of expressing this.<br />
** '''[effect]''' A modification applied to the unit whenever this advancement is chosen. See [[EffectWML]]<br />
<br />
==== Other tags ====<br />
* '''[base_unit]''' Contains one attribute, '''id''', which must be the ID of a unit type. If specified, the UnitWML for that unit is copied into this one. Subsequent attributes modify the copy. (1.3.7 and later versions only.)<br />
* '''[attack]''' one of the unit's attacks.<br />
** ''description'' a translatable text for name of the attack, to be displayed to the user.<br />
** ''name'' the name of the attack. Used as a default description, if ''description'' is not present, and to determine the default icon, if ''icon'' is not present (if ''name=x'' then ''icon=attacks/x.png'' is assumed unless present). Non-translatable. Used for the ''has_weapon'' key; see [[FilterWML]]<br />
** ''type'' the damage type of the attack. Used in determining resistance to this attack (see '''[resistances]''', [[UnitsWML]]). Possible values are 'blade', 'pierce', 'impact', 'fire', 'cold', and 'holy'.<br />
** ''special'' the special ability of the attack. Currently having more than 1 ability is not supported. See [[AbilitiesWML]] for a list of possible values.<br />
** ''icon'' the image to use as an icon for the attack in the attack choice menu, as a path relative to the images directory.<br />
** ''range'' the range of the attack. Used to determine the enemy's retaliation, which will be of the same type. Also displayed on the status table in parentheses; 'melee'(default) displays "melee", while 'ranged' displays "ranged". Range can be anything. Standard values are now "melee" and "ranged". From now on, ''short'' and ''long'' will be treated as totally different ranges. You can create any number of ranges now (with any name), and units can only retaliate against attacks for which they have a corresponding attack of the same range. This value is translatable.<br />
** ''damage'' the damage of this attack<br />
** ''number'' the number of strikes per attack this weapon has<br />
For those two following settings, the engine usually chooses the attack with the best average total damages * weight (default weight = 1.0).<br />
** ''attack_weight'' helps the AI to choose which attack to use when attacking; highly weighted attacks are more likely to be used. Setting it to 0 disables the attack on attack<br />
** ''defense_weight'' used to determine which attack is used for retaliation. This affects gameplay, as the player is not allowed to determine his unit's retaliation weapon. Setting it to 0 disable the attacks on defense <br />
<br />
** '''[animation]'''<br />
:: This describes an animation for this attack. If multiple animations are present, one will be randomly chosen each time the unit attacks. See [[AnimationWML]] for possible keys.<br />
<br />
* '''[defend]''' See [[AnimationWML]]<br />
* '''[death]''' See [[AnimationWML]]<br />
* '''[teleport_anim]''' See [[AnimationWML]]<br />
* '''[extra_anim]''' See [[AnimationWML]]<br />
* '''[event]''' Any [event] written inside the [unit] tag will get included into any scenario where a unit of this type appears in. Note that such events get included when a unit of this type first appears in the scenario, not automatically when the scenario begins (meaning that ''name=prestart'' events, for example, would usually never trigger). See [[EventWML]] and [[WML_Abilities]]<br />
<br />
* '''[variation]''' Defines a variation of a unit. Variations are invoked with an [effect] tag. They are currently used for graphical variations (giving character sprites new weapons) but theoretically you could do anything with it.<br />
** ''variation_name'' The name of the variation.<br />
** ''inherit'' if ''yes'', inherits all the properties of the base unit.<br />
: All other keys in '''[variation]''' are the same as for '''[unit]''' itself.<br />
<br />
* '''[male]''', '''[female]''' They can contain all '''[unit]''' tags, to specify a variation of different gender for a unit.<br />
<br />
* '''[abilities]''' Defines the abilities of a unit. See [[AbilitiesWML]]<br />
<br />
== See Also ==<br />
<br />
* [[AnimationWML]]<br />
* [[ReferenceWML]]<br />
* [[TerrainWML]]<br />
<br />
<br />
[[Category: WML Reference]]</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=BuildingUnits&diff=17494BuildingUnits2007-08-28T17:48:37Z<p>Floodbud: /* Recommended procedure */</p>
<hr />
<div>Making new units is fairly easy. Unit configuration files are plain text files that you can edit with any editor such as Notepad, TextEdit, gedit, pico, vi, emacs, etc. You will need to become familiar with [[UnitWML|WML]] in order to make a new unit. This page contains a more in-depth discussion of Unit WML syntax and will walk you through the creation of a new unit and discuss how you can use it in-game.<br />
<br />
== Recommended procedure ==<br />
The easiest way to make a new unit is to copy and paste an existing unit, then modify it. Navigate to the game's data/units directory and copy any unit. When you are editing the unit, pay attention to the property keys. If you forget to modify each key (for example, the unique id key), problems may arise, varying for minor issues such as lack of features on the unit, to game refusing to load the unit file, or, in the worst case, crashing the game. For complete reference on unit properties see [[UnitWML]].<br />
<br />
Most of a unit's properties are self-explanatory to anyone who has played Battle for Wesnoth for very long, and the tags in the WML files are brief but descriptive. It is recommmended that you try editing by yourself before consulting the guide. Otherwise, you may find the guide confusing.<br />
<br />
== Using your new unit ==<br />
Any unit in the game's ./data/units directory or ''userdata''/data/units will be recognized by the game. If you only want to put use it once or twice as a special unit, that's all you need to do. However, just because you made a new unit does NOT mean that it can be recruited. Each scenario and multiplayer era has a specific recruit list. If your unit is not on the list, you can't recruit it. This means you need to modify the ''recruit='' key in the appropriate configuration file. [[BuildingMultiplayer]] describes different ways you do this for multiplayer. To add a unit to a campaign, read about scenarios, sides, and recruit lists in [[BuildingScenarios]].<br />
<br />
== Distributing your unit ==<br />
If you made a single unit, post it on the [http://www.wesnoth.org/forum forum]. If you made a whole group of units, you can make them into a multiplayer faction or you can upload a unit pack.<br />
<br />
If you want to make a faction, follow the instructions in the [[BuildingFactions]] article. You should create a new era and add your units as one of the factions. You will not be able to add your units to any era that ships with the game.<br />
<br />
If you want to make a unit pack, the procedure is easier. Unit packs are distributed for campaign writers who want to use your units in their campaigns/eras. They download your unit pack and copy/paste the units and images into their campaign/era.<br />
* Navigate to the ''userdata''/data/campaigns directory. Everything from now on will occur relative to here. The era we'll use as an example will be called MyUnitPack<br />
* Create a text file called MyUnitPack.cfg. Add the following lines:<br />
# #define USE_MYUNITS #<- replace MYUNITS with something descriptive<br />
# #enddef<br />
# #ifdef USE_MYUNITS #<- replace MYUNITS with something descriptive<br />
# {@campaigns/MyUnitPack/}<br />
# #endif<br />
:* These lines are commented out (with the #). That way when the unit pack ships it won't affect the game. If someone wants the game to be able to see these units, he can uncomment those lines and it will work. However, this usually causes problems in multiplayer (you will be using units no one else has), but it can be fun for campaigns.<br />
:* NOTE: the commenting/uncommenting trick will only work if the units branch off of an existing unit. Custom L1 units will NOT show up in game automatically without editing another configuration file somewhere (scenario config file or multiplayer.cfg)<br />
* Create another text file called MyUnitPack.pbl. (See [[PblWML]] for more details about *.pbl files.) Add the following lines to it:<br />
author="''your name''"<br />
icon="''any image file in the game's ./images directory''"<br />
version="1.0"<br />
title="My Awesome Unit Pack"<br />
description="New race of lizard men."<br />
* Create a folder called MyUnitPack. Navigate to it.<br />
* Create two subdirectories: units and images. Place your unit cfg files and artwork into those subdirectories<br />
* Create a text file called MyUnitPack.cfg (or another name of your choosing). Add the following lines:<br />
[binary_path]<br />
path=data/campaigns/MyUnitPack<br />
[/binary_path]<br />
[+units]<br />
{@campaigns/MyUnitPack/units}<br />
[/units]<br />
* You should be ready to distribute your unit pack on the campaign server now<br />
* PLEASE change the names to something unique before you publish<br />
<br />
== Unit WML discussion ==<br />
<br />
Units are enclosed in '''[unit]''' tags.<br />
<br />
This section only provides some tips and pointers in making a unit. Feel free to add pointers of your own. For the full, current, complete WML reference on what to put in your [unit], see and frequently revisit [[UnitWML|The Unit WML reference page]].<br />
* The first attribute of a unit is the ''id'' key, which is a unique identifier for the unit. As value of the ''type'' attribute for these units, the ''id'' key is used. (See [[BuildingScenarios]]).<br />
* When referencing the unit in a ''type'' key, the id must be reproduced verbatim, without typos, and in a case-sensitive manner. If you don't do this, the key won't work. If you can't recruit in a scenario, it's probably because you have a typo in one of the unit ids and the ''recruit'' key was invalidated.<br />
* It also has a ''name'' key, which is the (translatable) name of the unit, and is displayed on the Status Table when a unit of this type is selected. It does not need to be unique (but it helps).<br />
* Do not set movement to 0. It creates weird infinite movement behavior. This might be fixed in the future. For now, to make an immobile unit, set movement to 1 use [movement_costs] to make it unable to move onto any terrain.<br />
* Also, make sure you give the unit at least one [attack]. If not, there is a bug in the game code that will cause the game to crash when it attempts to find attacks. This may also be fixed in the future.<br />
* See [[BuildingScenariosIntermediate]] for more information on attacks.<br />
<br />
== See Also ==<br />
<br />
* [[Create]]<br />
* [[EditingWesnoth]]<br />
* [[Creating Unit Art]]<br />
* [[CampaignServerWML]]<br />
* [[PblWML]]<br />
* [[BuildingCampaignsThePBLFile]]<br />
* [[Team_Color_Shifting]]<br />
<br />
{{Create}}</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=BuildingUnits&diff=17493BuildingUnits2007-08-28T17:47:59Z<p>Floodbud: /* Recommended procedure */</p>
<hr />
<div>Making new units is fairly easy. Unit configuration files are plain text files that you can edit with any editor such as Notepad, TextEdit, gedit, pico, vi, emacs, etc. You will need to become familiar with [[UnitWML|WML]] in order to make a new unit. This page contains a more in-depth discussion of Unit WML syntax and will walk you through the creation of a new unit and discuss how you can use it in-game.<br />
<br />
== Recommended procedure ==<br />
The easiest way to make a new unit is to copy and paste an existing unit, then modify it. Navigate to the game's data/units directory and copy any unit. When you are editing the unit, pay attention to the property keys. If you forget to modify each key (for example, the unique id key), problems may arise, varying for minor issues such as lack of features on the unit, to game refusing to load the unit file, or, in the worst case, crashing the game. For complete reference on unit properties see [[UnitWML]].<br />
<br />
Most of a unit's properties are self-explanatory to anyone who has played Battle for Wesnoth for very long, and the tags are brief but descriptive. It is recommmended that you try it for yourself before consulting the guide. Otherwise, you may find the guide confusing.<br />
<br />
== Using your new unit ==<br />
Any unit in the game's ./data/units directory or ''userdata''/data/units will be recognized by the game. If you only want to put use it once or twice as a special unit, that's all you need to do. However, just because you made a new unit does NOT mean that it can be recruited. Each scenario and multiplayer era has a specific recruit list. If your unit is not on the list, you can't recruit it. This means you need to modify the ''recruit='' key in the appropriate configuration file. [[BuildingMultiplayer]] describes different ways you do this for multiplayer. To add a unit to a campaign, read about scenarios, sides, and recruit lists in [[BuildingScenarios]].<br />
<br />
== Distributing your unit ==<br />
If you made a single unit, post it on the [http://www.wesnoth.org/forum forum]. If you made a whole group of units, you can make them into a multiplayer faction or you can upload a unit pack.<br />
<br />
If you want to make a faction, follow the instructions in the [[BuildingFactions]] article. You should create a new era and add your units as one of the factions. You will not be able to add your units to any era that ships with the game.<br />
<br />
If you want to make a unit pack, the procedure is easier. Unit packs are distributed for campaign writers who want to use your units in their campaigns/eras. They download your unit pack and copy/paste the units and images into their campaign/era.<br />
* Navigate to the ''userdata''/data/campaigns directory. Everything from now on will occur relative to here. The era we'll use as an example will be called MyUnitPack<br />
* Create a text file called MyUnitPack.cfg. Add the following lines:<br />
# #define USE_MYUNITS #<- replace MYUNITS with something descriptive<br />
# #enddef<br />
# #ifdef USE_MYUNITS #<- replace MYUNITS with something descriptive<br />
# {@campaigns/MyUnitPack/}<br />
# #endif<br />
:* These lines are commented out (with the #). That way when the unit pack ships it won't affect the game. If someone wants the game to be able to see these units, he can uncomment those lines and it will work. However, this usually causes problems in multiplayer (you will be using units no one else has), but it can be fun for campaigns.<br />
:* NOTE: the commenting/uncommenting trick will only work if the units branch off of an existing unit. Custom L1 units will NOT show up in game automatically without editing another configuration file somewhere (scenario config file or multiplayer.cfg)<br />
* Create another text file called MyUnitPack.pbl. (See [[PblWML]] for more details about *.pbl files.) Add the following lines to it:<br />
author="''your name''"<br />
icon="''any image file in the game's ./images directory''"<br />
version="1.0"<br />
title="My Awesome Unit Pack"<br />
description="New race of lizard men."<br />
* Create a folder called MyUnitPack. Navigate to it.<br />
* Create two subdirectories: units and images. Place your unit cfg files and artwork into those subdirectories<br />
* Create a text file called MyUnitPack.cfg (or another name of your choosing). Add the following lines:<br />
[binary_path]<br />
path=data/campaigns/MyUnitPack<br />
[/binary_path]<br />
[+units]<br />
{@campaigns/MyUnitPack/units}<br />
[/units]<br />
* You should be ready to distribute your unit pack on the campaign server now<br />
* PLEASE change the names to something unique before you publish<br />
<br />
== Unit WML discussion ==<br />
<br />
Units are enclosed in '''[unit]''' tags.<br />
<br />
This section only provides some tips and pointers in making a unit. Feel free to add pointers of your own. For the full, current, complete WML reference on what to put in your [unit], see and frequently revisit [[UnitWML|The Unit WML reference page]].<br />
* The first attribute of a unit is the ''id'' key, which is a unique identifier for the unit. As value of the ''type'' attribute for these units, the ''id'' key is used. (See [[BuildingScenarios]]).<br />
* When referencing the unit in a ''type'' key, the id must be reproduced verbatim, without typos, and in a case-sensitive manner. If you don't do this, the key won't work. If you can't recruit in a scenario, it's probably because you have a typo in one of the unit ids and the ''recruit'' key was invalidated.<br />
* It also has a ''name'' key, which is the (translatable) name of the unit, and is displayed on the Status Table when a unit of this type is selected. It does not need to be unique (but it helps).<br />
* Do not set movement to 0. It creates weird infinite movement behavior. This might be fixed in the future. For now, to make an immobile unit, set movement to 1 use [movement_costs] to make it unable to move onto any terrain.<br />
* Also, make sure you give the unit at least one [attack]. If not, there is a bug in the game code that will cause the game to crash when it attempts to find attacks. This may also be fixed in the future.<br />
* See [[BuildingScenariosIntermediate]] for more information on attacks.<br />
<br />
== See Also ==<br />
<br />
* [[Create]]<br />
* [[EditingWesnoth]]<br />
* [[Creating Unit Art]]<br />
* [[CampaignServerWML]]<br />
* [[PblWML]]<br />
* [[BuildingCampaignsThePBLFile]]<br />
* [[Team_Color_Shifting]]<br />
<br />
{{Create}}</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=BuildingUnits&diff=17492BuildingUnits2007-08-28T17:46:35Z<p>Floodbud: /* Recommended procedure */</p>
<hr />
<div>Making new units is fairly easy. Unit configuration files are plain text files that you can edit with any editor such as Notepad, TextEdit, gedit, pico, vi, emacs, etc. You will need to become familiar with [[UnitWML|WML]] in order to make a new unit. This page contains a more in-depth discussion of Unit WML syntax and will walk you through the creation of a new unit and discuss how you can use it in-game.<br />
<br />
== Recommended procedure ==<br />
The easiest way to make a new unit is to copy and paste an existing unit, then modify it. Navigate to the game's data/units directory and copy any unit. When you are editing the unit, pay attention to the property keys. If you forget to modify each key (for example, the unique id key), problems may arise, varying for minor issues such as lack of features on the unit, to game refusing to load the unit file, or, in the worst case, crashing the game. For complete reference on unit properties see [[UnitWML]].<br />
<br />
Most of a unit's properties are self-explanatory to anyone who has played Battle for Wesnoth for very long. You may not need the [[UnitWML]] guide, which is unfinished and somewhat confusing.<br />
<br />
== Using your new unit ==<br />
Any unit in the game's ./data/units directory or ''userdata''/data/units will be recognized by the game. If you only want to put use it once or twice as a special unit, that's all you need to do. However, just because you made a new unit does NOT mean that it can be recruited. Each scenario and multiplayer era has a specific recruit list. If your unit is not on the list, you can't recruit it. This means you need to modify the ''recruit='' key in the appropriate configuration file. [[BuildingMultiplayer]] describes different ways you do this for multiplayer. To add a unit to a campaign, read about scenarios, sides, and recruit lists in [[BuildingScenarios]].<br />
<br />
== Distributing your unit ==<br />
If you made a single unit, post it on the [http://www.wesnoth.org/forum forum]. If you made a whole group of units, you can make them into a multiplayer faction or you can upload a unit pack.<br />
<br />
If you want to make a faction, follow the instructions in the [[BuildingFactions]] article. You should create a new era and add your units as one of the factions. You will not be able to add your units to any era that ships with the game.<br />
<br />
If you want to make a unit pack, the procedure is easier. Unit packs are distributed for campaign writers who want to use your units in their campaigns/eras. They download your unit pack and copy/paste the units and images into their campaign/era.<br />
* Navigate to the ''userdata''/data/campaigns directory. Everything from now on will occur relative to here. The era we'll use as an example will be called MyUnitPack<br />
* Create a text file called MyUnitPack.cfg. Add the following lines:<br />
# #define USE_MYUNITS #<- replace MYUNITS with something descriptive<br />
# #enddef<br />
# #ifdef USE_MYUNITS #<- replace MYUNITS with something descriptive<br />
# {@campaigns/MyUnitPack/}<br />
# #endif<br />
:* These lines are commented out (with the #). That way when the unit pack ships it won't affect the game. If someone wants the game to be able to see these units, he can uncomment those lines and it will work. However, this usually causes problems in multiplayer (you will be using units no one else has), but it can be fun for campaigns.<br />
:* NOTE: the commenting/uncommenting trick will only work if the units branch off of an existing unit. Custom L1 units will NOT show up in game automatically without editing another configuration file somewhere (scenario config file or multiplayer.cfg)<br />
* Create another text file called MyUnitPack.pbl. (See [[PblWML]] for more details about *.pbl files.) Add the following lines to it:<br />
author="''your name''"<br />
icon="''any image file in the game's ./images directory''"<br />
version="1.0"<br />
title="My Awesome Unit Pack"<br />
description="New race of lizard men."<br />
* Create a folder called MyUnitPack. Navigate to it.<br />
* Create two subdirectories: units and images. Place your unit cfg files and artwork into those subdirectories<br />
* Create a text file called MyUnitPack.cfg (or another name of your choosing). Add the following lines:<br />
[binary_path]<br />
path=data/campaigns/MyUnitPack<br />
[/binary_path]<br />
[+units]<br />
{@campaigns/MyUnitPack/units}<br />
[/units]<br />
* You should be ready to distribute your unit pack on the campaign server now<br />
* PLEASE change the names to something unique before you publish<br />
<br />
== Unit WML discussion ==<br />
<br />
Units are enclosed in '''[unit]''' tags.<br />
<br />
This section only provides some tips and pointers in making a unit. Feel free to add pointers of your own. For the full, current, complete WML reference on what to put in your [unit], see and frequently revisit [[UnitWML|The Unit WML reference page]].<br />
* The first attribute of a unit is the ''id'' key, which is a unique identifier for the unit. As value of the ''type'' attribute for these units, the ''id'' key is used. (See [[BuildingScenarios]]).<br />
* When referencing the unit in a ''type'' key, the id must be reproduced verbatim, without typos, and in a case-sensitive manner. If you don't do this, the key won't work. If you can't recruit in a scenario, it's probably because you have a typo in one of the unit ids and the ''recruit'' key was invalidated.<br />
* It also has a ''name'' key, which is the (translatable) name of the unit, and is displayed on the Status Table when a unit of this type is selected. It does not need to be unique (but it helps).<br />
* Do not set movement to 0. It creates weird infinite movement behavior. This might be fixed in the future. For now, to make an immobile unit, set movement to 1 use [movement_costs] to make it unable to move onto any terrain.<br />
* Also, make sure you give the unit at least one [attack]. If not, there is a bug in the game code that will cause the game to crash when it attempts to find attacks. This may also be fixed in the future.<br />
* See [[BuildingScenariosIntermediate]] for more information on attacks.<br />
<br />
== See Also ==<br />
<br />
* [[Create]]<br />
* [[EditingWesnoth]]<br />
* [[Creating Unit Art]]<br />
* [[CampaignServerWML]]<br />
* [[PblWML]]<br />
* [[BuildingCampaignsThePBLFile]]<br />
* [[Team_Color_Shifting]]<br />
<br />
{{Create}}</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=User_talk:Floodbud&diff=17491User talk:Floodbud2007-08-28T17:32:22Z<p>Floodbud: </p>
<hr />
<div>Hey, go ahead and post. Just nothing crude, offensive, etc. Constructive criticism is welcomed.</div>Floodbudhttps://wiki.wesnoth.org/index.php?title=User:Floodbud&diff=17490User:Floodbud2007-08-28T17:31:47Z<p>Floodbud: </p>
<hr />
<div>I am pretty new to this wiki but not to wikis in general. I hope to make the wiki more useful for general, inexperienced users. I appreciate all feedback.</div>Floodbud