AchievementsWML: Difference between revisions
→[achievement_group]: Fix tag name to match actually recognized tag |
→[achievement]: Note where [sub_achievement] goes |
||
| (14 intermediate revisions by 3 users not shown) | |||
| Line 11: | Line 11: | ||
The following keys and tags are recognized in '''[achievement_group]''' tags: | 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. | * '''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]''': See below. | ||
=== [achievement] === | === [achievement] === | ||
The following keys are recognized in '''[achievement]''' tags: | The following keys and tags are recognized in '''[achievement]''' tags: | ||
* '''id''': (''required'') The internal ID to be used when identifying this achievement. Must be unique within an [achievements_group]. | * '''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. | * '''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. | * '''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. | * '''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. | * '''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 | * '''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). This will be automatically scaled to 72x72 pixels. If the achievement is incomplete it will be shown in greyscale. | ||
* '''icon_completed''': (optional) The | * '''icon_completed''': (optional) Overrides '''icon''' when the achievement has been completed; defaults to the value of '''icon'''. | ||
* ''' | * '''max_progress''': (optional) The progress value at which this achievement is considered to be complete. Do not use this in an achievement which also uses [[AchievementsWML#sub_achievement|[sub_achievement]]]. | ||
* ''' | * '''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]''': see below | ||
=== [sub_achievement] === | |||
{{DevFeature1.17|17}} | |||
This is a way to show progress towards an achievement, identifying exactly which stages have been completed. An [achievement] which has [sub_achievement] tags should not have a max_progress attribute; if both are used in the same [achievement], the behavior is implementation-defined. | |||
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 13:32, 29 October 2026
(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 and tags 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). This will be automatically scaled to 72x72 pixels. If the achievement is incomplete it will be shown in greyscale. - icon_completed: (optional) Overrides icon when the achievement has been completed; defaults to the value of icon.
- max_progress: (optional) The progress value at which this achievement is considered to be complete. Do not use this in an achievement which also uses [sub_achievement].
- 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]: see below
[sub_achievement]
(Version 1.17.17 and later only)
This is a way to show progress towards an achievement, identifying exactly which stages have been completed. An [achievement] which has [sub_achievement] tags should not have a max_progress attribute; if both are used in the same [achievement], the behavior is implementation-defined.
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.