Limited support
This feature is only present in Portal 2: Community Edition.

AchievementsAPI

Functions

GetAchievedDuringCurrentGame

AchievementsAPI.GetAchievedDuringCurrentGame(): number[]

Returns an array of achievement indices that have been achieved during this session of gameplay

GetAchievement

AchievementsAPI.GetAchievement(index: number): Achievement

Returns a description of the specified achievement

Parameter

Name Type Description
index number Index of the achievement

GetAchievementCount

AchievementsAPI.GetAchievementCount(): number

Returns the total number of achievements

GetAchievements

AchievementsAPI.GetAchievements(): Achievement[]

Returns a complete list of all achievements. Shorthand for calling GetAchievement for each index

HasAchievement

AchievementsAPI.HasAchievement(index: number): boolean

Returns true if this achievement has been granted

Parameter

Name Type Description
index number Achievement index

HasAchievementByName

AchievementsAPI.HasAchievementByName(name: string): boolean

Returns true if this achievement has been granted

Parameter

Name Type Description
name string Name of the achievement

HasCheated

AchievementsAPI.HasCheated(): boolean

Returns true if cheats were turned on at any point during this session