Difference between revisions of "AchievementsWML"
From The Battle for Wesnoth Wiki
Pentarctagon (talk | contribs) |
Pentarctagon (talk | contribs) (→[sub_achievement]) |
||
(25 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{WML Tags}} | {{WML Tags}} | ||
− | |||
{{DevFeature1.17|13}} | {{DevFeature1.17|13}} | ||
== Achievements == | == Achievements == | ||
+ | |||
+ | Achievements are defined in an achievements.cfg file located at the root directory of an add-on (in the same folder as the _main.cfg). The WML in the achievements.cfg file is loaded completely independently of any other WML in your add-on or in mainline Wesnoth - this means you do not have access to any macros that are not defined in this file nor the context setup by the [[BinaryPathWML|[binary_path]]]. | ||
+ | |||
+ | === [achievement_group] === | ||
+ | |||
+ | The following keys and tags are recognized in '''[achievement_group]''' tags: | ||
+ | * '''content_for''': The internal identifier for this group of achievements. The standard usage would be to have this be unique per add-on or per piece of content (campaign, modification, etc), however there is no limitation on how achievement groups are declared - an add-on can define as many achievement groups as it wants. If multiple achievements groups are defined with the same '''content_for''' value, then their achievements are merged into a single combined list. | ||
+ | * '''display_name''': (translatable) The text to be displayed on the content dropdown of the achievements dialog. | ||
+ | * '''[achievement]''': See below. | ||
+ | |||
+ | === [achievement] === | ||
+ | |||
+ | The following keys are recognized in '''[achievement]''' tags: | ||
+ | * '''id''': (''required'') The internal ID to be used when identifying this achievement. Must be unique within an [achievements_group]. | ||
+ | * '''name''': (''required'') (translatable) The achievement name to display on the achievements dialog. Supports Pango markup. | ||
+ | * '''name_completed''': (translatable) (optional) The achievement name to display on the achievements dialog when this achievement has been completed. Supports Pango markup. | ||
+ | * '''description''': (''required'') (translatable) The achievement description to display on the achievements dialog. Supports Pango markup. | ||
+ | * '''description_completed''': (translatable) (optional) The achievement description to display on the achievements dialog when this achievement has been completed. Supports Pango markup. | ||
+ | * '''icon''': The image to display next to this achievement on the achievements dialog, scaled to be 72x72 pixels. '''This must be the full path to the image!''' For example - <code>data/core/images/icons/potion_green_small.png</code> (mainline) or <code>data/add-ons/YourAddon/images/icons/some_image.png</code> (add-on). | ||
+ | * '''icon_completed''': (optional) The image to display next to this achievement on the achievements dialog when this achievement has been completed, scaled to be 60x60 pixels. '''This must be the full path to the image!''' For example - <code>data/core/images/icons/potion_green_small.png</code> (mainline) or <code>data/add-ons/YourAddon/images/icons/some_image.png</code> (add-on). | ||
+ | * '''hidden''': (optional) When set to '''yes''', the achievement is not shown in the achievements dialog until it is completed. Default: no. | ||
+ | * '''max_progress''': (optional) The progress value at which this achievement is considered to be complete. | ||
+ | * '''sound''': (optional) The path to a sound to play when the achievement is completed. '''This must be the full path to the sound!''' For example - <code>data/core/sounds/dwarf-laugh.wav</code> (mainline) or <code>data/add-ons/YourAddon/sounds/some_sound.ogg</code> (add-on). | ||
+ | |||
+ | === [sub_achievement] === | ||
+ | |||
+ | {{DevFeature1.17|17}} | ||
+ | |||
+ | The following keys are recognized in '''[sub_achievement]''' tags: | ||
+ | |||
+ | * '''id''': (''required'') The internal ID to be used when identifying this sub-achievement. Must be unique within an [achievement]. | ||
+ | * '''description''': (''required'') (translatable) The text to display when hovering over the sub-achievement's icon. | ||
+ | * '''icon''': The image to display for to this sub-achievement on the achievements dialog, scaled to be 36x36 pixels. '''This must be the full path to the image!''' For example - <code>data/core/images/icons/potion_green_small.png</code> (mainline) or <code>data/add-ons/YourAddon/images/icons/some_image.png</code> (add-on). | ||
+ | |||
+ | A maximum of 28 sub-achievements can be defined for an achievement. |
Latest revision as of 05:06, 18 May 2023
(Version 1.17.13 and later only)
Achievements
Achievements are defined in an achievements.cfg file located at the root directory of an add-on (in the same folder as the _main.cfg). The WML in the achievements.cfg file is loaded completely independently of any other WML in your add-on or in mainline Wesnoth - this means you do not have access to any macros that are not defined in this file nor the context setup by the [binary_path].
[achievement_group]
The following keys and tags are recognized in [achievement_group] tags:
- content_for: The internal identifier for this group of achievements. The standard usage would be to have this be unique per add-on or per piece of content (campaign, modification, etc), however there is no limitation on how achievement groups are declared - an add-on can define as many achievement groups as it wants. If multiple achievements groups are defined with the same content_for value, then their achievements are merged into a single combined list.
- display_name: (translatable) The text to be displayed on the content dropdown of the achievements dialog.
- [achievement]: See below.
[achievement]
The following keys are recognized in [achievement] tags:
- id: (required) The internal ID to be used when identifying this achievement. Must be unique within an [achievements_group].
- name: (required) (translatable) The achievement name to display on the achievements dialog. Supports Pango markup.
- name_completed: (translatable) (optional) The achievement name to display on the achievements dialog when this achievement has been completed. Supports Pango markup.
- description: (required) (translatable) The achievement description to display on the achievements dialog. Supports Pango markup.
- description_completed: (translatable) (optional) The achievement description to display on the achievements dialog when this achievement has been completed. Supports Pango markup.
- icon: The image to display next to this achievement on the achievements dialog, scaled to be 72x72 pixels. This must be the full path to the image! For example -
data/core/images/icons/potion_green_small.png
(mainline) ordata/add-ons/YourAddon/images/icons/some_image.png
(add-on). - icon_completed: (optional) The image to display next to this achievement on the achievements dialog when this achievement has been completed, scaled to be 60x60 pixels. This must be the full path to the image! For example -
data/core/images/icons/potion_green_small.png
(mainline) ordata/add-ons/YourAddon/images/icons/some_image.png
(add-on). - hidden: (optional) When set to yes, the achievement is not shown in the achievements dialog until it is completed. Default: no.
- max_progress: (optional) The progress value at which this achievement is considered to be complete.
- sound: (optional) The path to a sound to play when the achievement is completed. This must be the full path to the sound! For example -
data/core/sounds/dwarf-laugh.wav
(mainline) ordata/add-ons/YourAddon/sounds/some_sound.ogg
(add-on).
[sub_achievement]
(Version 1.17.17 and later only)
The following keys are recognized in [sub_achievement] tags:
- id: (required) The internal ID to be used when identifying this sub-achievement. Must be unique within an [achievement].
- description: (required) (translatable) The text to display when hovering over the sub-achievement's icon.
- icon: The image to display for to this sub-achievement on the achievements dialog, scaled to be 36x36 pixels. This must be the full path to the image! For example -
data/core/images/icons/potion_green_small.png
(mainline) ordata/add-ons/YourAddon/images/icons/some_image.png
(add-on).
A maximum of 28 sub-achievements can be defined for an achievement.
This page was last edited on 18 May 2023, at 05:06.