Achievements
Updated for version 3.38.
Module Definition
The module is inherited from ItemModuleBase. So base parameters can be found there.
This module will allow you to add your own achievements within your mods. They will appear in the Custom Achievements menu which can be accessed next to the button to check on BeardLib mods.
Module Name
The name of the module you use as the meta of the module definition is 'Achievements' or 'AchievementsModule' if _force_search
is set to true in the module definition.
XML Structure
<Achievements id name desc icon banner>
<Achievements id name desc icon banner>
Parameter | Type | Description |
---|---|---|
id | String | The ID of your achievement package, which will hold all your achievements. |
name | String | A localized string ID for the package's name. Default : |
desc | String | A localized string ID for the package's description. Default : |
icon | String | The path to a custom icon for your achievement package. It has to be added through the AddFiles module beforehand. Default: |
banner | String | The path to a custom banner for your achievement package. It has to be added through the AddFiles module beforehand. Ideal scale: 820x90 |
The name
, desc
, icon
and banner
options are optional.
<achievement id name_id desc_id objective_id icon rank amount reward_type reward_amount hidden_achievement />
<achievement id name_id desc_id objective_id icon rank amount reward_type reward_amount hidden_achievement />
Parameter | Type | Description |
---|---|---|
id | String | The ID of your achievement, which is used to manipulate that particular achievement later. |
name_id | String | A localized string ID for the achievement's name. Default : |
desc_id | String | A localized string ID for the achievement's description. Default : |
objective_id | String | A localized string ID for the achievement's objective. Default : |
icon | String | The path to a custom icon for your achievement. It has to be added through the AddFiles module beforehand. Default: |
rank | Integer | Integer from 1 to 4. Defines the achievement rank based on Custom Achievement API: 1 = Bronze, 2 = Silver, 3 = Gold, 4 = Platinum |
amount | Integer | Useful for counting things, and saving the progress each time it increases. Once amount is reached, the achievement is automatically unlocked. |
reward_type | String | Can be |
reward_amount | Integer | Has to be an integer that defines how much of |
hidden_achievement | Boolean | Hides the details of the achievement such as the description, objective, icon and rank. Once unlocked, the details will appear. |
Example
CustomAchievementManager - Functions
Function | Description |
---|---|
HasPackage( String package_id ) | Returns |
HasAchievement( String package_id, String achievement_id ) | Returns |
NumberOfPackages() | Returns a integer on the number of packages the user currently has. |
NumberOfAchievements() | Returns a integer on the number of all the achievements the player has, unlocked or not. |
CompletedAchievementsTotal() | Returns a integer on the number of all the achievements the player has unlocked only. |
CustomAchievementPackage - Functions
Function | Description |
---|---|
init( String package_id ) | Initialize a new achievement package with the given |
GetName() | Get the name of the package. The returned value is already passed through |
GetDesc() | Get the description of the package. The returned value is already passed through |
GetIcon() | Get the current package icon path. |
GetBanner() | Get the current package banner path. |
ManualAchievementAddition( String achievement_id, Table config ) | Allows to add an achievement to the package manually. This is useful for multiple mods adding achievements to a unique package. |
HasAchievement( String achievement_id ) | Returns |
Achievement (String achievement_id ) | Initialize the class CustomAchievement with the provided achievement ID. |
GetTotalAchievements() | Returns an integer of the current total of all the achievements within the package. |
GetCompletedAchievements() | Returns an integer of the unlocked achievements within the package. |
AllAchievementsCompletedExceptOne() | Returns |
CustomAchievement - Functions
Function | Description |
---|---|
init( Table config, String package ) | Initialize the class in order to use all other functions. It's better to first initialize the package in order to bypass the manual initialization, through |
GetName() | Get the name of the achievement. The returned value is already passed through |
GetDesc() | Get the description of the achievement. The returned value is already passed through |
GetObjective() | Get the objective of the achievement. The returned value is already passed through |
GetIcon() | Get the current achievement icon path. |
GetUnlockTimestamp() | Get the UNIX timestamp of the unlocked achievement. If the achievement isn't unlocked, this will return |
Package() | Initialize CustomAchievementPackage of this achievement. |
IncreaseAmount( Integer amount, Boolean to_max ) | Calling this function will increase the |
Unlock() | Unlocks the achievement. |
Lock() | Lock the achievement. |
IsUnlocked() | Returns |
IsHidden() | Returns |
HasReward() | Returns |
Last updated