Achievements

From GMod Wiki

Jump to: navigation, search


Library used by the game to display the achievements.

Library Functions

NewerClient.png achievements.BalloonPopped
NewerClient.png achievements.Count
NewerClient.png achievements.EatBall
NewerClient.png achievements.GetCount
NewerClient.png achievements.GetDesc
NewerClient.png achievements.GetGoal
NewerClient.png achievements.GetName
NewerClient.png achievements.IncBaddies
NewerClient.png achievements.IncBystander
NewerClient.png achievements.IncGoodies
NewerClient.png achievements.IsAchieved
NewerClient.png achievements.Remover
NewerClient.png achievements.SpawnMenuOpen
NewerClient.png achievements.SpawnedNPC
NewerClient.png achievements.SpawnedProp
NewerClient.png achievements.SpawnedRagdoll

Examples

DescriptionGood use of all of these concepts.
Used onNewerClient.png
Code
local achievmentsID, count, goal, achieved, desc, name = achievements.Count()
for achievmentsID = 1, achievmentsID do
	count = achievements.GetCount(achievementsID)
	goal = achievements.GetGoal(achievementsID)
	achieved = achievements.IsAchieved(achievementsID)
	desc = achievements.GetDesc(achievementsID)
	name = achievements.GetName(achievementsID)
	print(count, goal, achieved, desc, name)
end
OutputN/A



DescriptionPrints all of the achieved achievements to the chat area!
Used onNewerClient.png
Code
 
for AchievementNum = 1, achievements.Count() do
--[[ 
     Keep incrementing "AchievementNum" by 1,
     until we reach the achivements count/number
--]]
 
    if achievements.IsAchieved( AchievementNum ) then 
        chat.AddText( Color(0,255,0), achievements.GetName( AchievementNum ) .. " is achieved!" ) 
--[[ 
     Checks if the achievement with the current id is achieved!
     prints the achievement's name plus the string "is achieved!"
     "is achieved!" in green to the chat area (seen by client only)
--]]
 
    end
end
 
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox