Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
https://developer.valvesoftware.com/wiki/Steam_Web_API
See this page:
http://steamcommunity.com/id/ChetFaliszek/stats/224260/?tab=achievements
Notice how the achievements have: 0/500
But working through the API I don't see how to get the "0/500" data for the users. I also don't see any way of associating the achievement to the total "500" it needs - Is it possible to get this data? If so, how?
For example with Team Fortress 2 you will see a bunch of achievements & stats, some of the STATS are the achievement name followed by _STATS, so you can see the total # of stats needed to complete the achievement (if the achievement has been completed).
I don't see anything that links STAT to Achievement - but obviously somewhere there is since Steam can do it. Maybe Steam just doesn't want anyone else to have this information?
the _STAT appears only on two games from what I found - otherwise I would just look for that field to track it.
Thank you for trying to help either way!
Still no one :(
"The achievement will also automatically unlock when the stat reaches the unlock value."
but never explains what "Unlock value" means.
It might be the Maximum Value of the Stat that it is tracking. Or can you specify a value directly in the achievement definition when you use Progress Stat?
As for getting the value and progress, this is done by querying the stat, not the achievement. And then it seems you have to just know what your maximum is.
But you can also use
https://partner.steamgames.com/doc/api/ISteamUserStats#IndicateAchievementProgress
but I don't understand how it interfaces with the stats.
It triggers a UserAchievementStored_t callback, which seems to contain some info about the progress, but only AFTER you stored it, so I'm not sure what the use case for that is.
With the GetUserStatsForGame API endpoint
The value is implied by the number of items in the achievements array. If you take the length of that array, that's the total number of achievements, lets say 500.
Then you filter through the array of objects for objects that have the key achieved === 1
The length of the filtered array is the number of achievements you've unlocked. Example ES6 Javascript code:
const maxAchievements = data.playerstats.achievements.length
const unlockedAchievements =
data.playerstats.achievements.filter((achievement) => {
return achievement.achieved === 1}
)
// lets say this is 100
const achievementString =
`${unlockedAchievements } / ${maxAchievements} achievements unlocked`
console.log(achievementString)
// this prints in the console:
// 100 / 500 achievements unlocked
Thanks, but this only gives me the maximum number of achievements. But not the progress of a single Achievement.
GetUserStatsForGame sends a list of achievements, yes. And a list of achievement stats. But each stat has only a value with the current progress of the corresponding achievement.
For example there is a achievement where I have to kill 100 monsters. The value there is 20. That means I killed 20 monsters. However, it is not clear anywhere that the target value is 100. The value is not displayed anywhere as far as I know.