I'm using the following code to parse through all the achievements in the game:
Lua Code:
for topLevelIndex = 1, GetNumAchievementCategories() do
local categoryName, numSubCatgories, _ = GetAchievementCategoryInfo(topLevelIndex)
d(categoryName)
if self.svAccount.achievements[categoryName] == nil then self.svAccount.achievements[categoryName] = {totalPoints = 0, categoryIndex = topLevelIndex, subCategories = {}} end
for subCategoryIndex = 1, numSubCatgories do
local subCategoryName, numSubAchievements = GetAchievementSubCategoryInfo(topLevelIndex, subCategoryIndex)
if self.svAccount.achievements[categoryName]["subCategories"][subCategoryName] == nil then self.svAccount.achievements[categoryName]["subCategories"][subCategoryName] = {} end
for index = 1, numSubAchievements do
local id = GetAchievementId(topLevelIndex, subCategoryIndex, index)
local name, _, points, _, completed, date, _ = GetAchievementInfo(id)
if self.svAccount.achievements[categoryName]["subCategories"][subCategoryName][name] == nil then self.svAccount.achievements[categoryName]["subCategories"][subCategoryName][name] = {id = id, characters = {}} end
if completed then
local characterArray = self.svAccount.achievements[categoryName]["subCategories"][subCategoryName][name]["characters"]
characterArray[#characterArray + 1] = {name = playerName, date = date}
end
end
end
end
When I use Zgoo to inspect the saved variables, I noticed that the general sub category was only recorded for the category of Harrowstorm and Stonethorns (the two most recent dungeon DLCs). It was missing from every other category. If this is the intended behavior, how do I capture the general subcategories? I don't see any other functions from the
API page on the wiki which could give that info.