How to make achievements for RabidToaster's Achievement Addon

Hai. Todae I r teech u hao to duu dis. N nao i stawp w/ 1337 spek.

[lua]
// Achievement by Teh_Spy
// Version 1.1

// Achievement: Equip your para.
[/lua]
These lines have nothing to do with the achievement, they are just there to mark that you made it or to keep track of the version history.
In fact, you can delete them and nothing will happen. Usually, if something has an “//” in front of it then you can delete the line without worry. Even though, you probably wouldn’t ever need to. They are put there to leave notes for later releases and/or modifications.
[lua]
local Value = achievements.GetValue( “Para… MEDIC!”, “total”, 0 ) [/lua] This line should only be edited to change the name. The name is this part. “Para… MEDIC!”. You want to change that to the name of your achievement. Example: “My First Achievement”

[lua]
local Status = false

local function Update()

if (Value != 1) then
	// print("Check Started.

")
local ply = LocalPlayer()
local weap = ply:GetActiveWeapon()

	if (!ValidEntity( ply )) then return end
	
	if ( ValidEntity( weap ) && weap:GetClass() == "weapon_para" ) then

[/lua]
This line checks to see if the player’s weapon is the para from CS:S.
The only thing you should be worried about is the “weapon_” part. You want to change that to whatever weapon you want. You will need a valid ID for it, though. I suggest using google for looking for HL2 “Cheats” and it will say under “Give” commands–The valid ID for the weapon. EX: Weapon_RPG, Weapon_Frag.

[lua]
if !Status then
Status = true
// print("Para Started.
")
Value = math.Clamp( Value + 1, 0, 1 )
achievements.SetValue( “Para… MEDIC!”, “total”, Value )
achievements.Update( “Para… MEDIC!”, Value / 1, Value … “/1” )
end
else
Status = false
// print("Para Ended.
")
end
[/lua]
These lines ensure that the player has no longer equipped the para. Along with the mathematics for how many times. If you wanted to change the amount of times you want to switch to your para, change the section “math.Clamp( Value +1, 0, X )” and "Value / 1, Value … “/1” ). Obviously, replacing the X’s with the number you want.

If you change the “( Value +1,” to another number, such as 2, your achievement will automatically calculate as +2 every time the player does the specific task.

[lua]
// print("Check Ended.
")

else
	timer.Destroy("Achievement.paramedic")
end

end
[/lua]
This part makes the add-on read that you have no longer have your para equipped. Very simple, right?
[lua]
timer.Create(“Achievement.paramedic”, 1, 0, Update)
[/lua]
This line, should be the name of the file. Replace “Achievement.paramedic” with whatever you are going to save your achievement .lua as.
Example: “Achievement.myfirst”.
If I remember correctly, you probably want to change the number 1 to whatever you want on the section:
“, 1, 0, Update”
[lua]
achievements.Register( “Para… MEDIC!”, “Equip an M249 Para.”, “achievements/paramedic”, Value / 1, Value … “/1” )
[/lua]

This is what I call the “Defining” section. I am going to break it up into easier portions for you all.
[lua]
( “Para… MEDIC!”
[/lua]
This is the name of your achievement.
[lua]
“Equip an M249 Para.”
[/lua]
This is not important, infact you can leave it blank. This is the “Description” line that will appear under your achievement’s name in-game.
[lua]“achievements/paramedic”[/lua]
This is the icon of your achievement in achievements\materials\achievements
You will need to rename “paramedic” with whatever your .vmt file is named and your VMT has to be set to the image icon.
[lua]
Value / 1, Value … “/1” )[/lua]
This is the progress bar. You want to change these numbers to match up with the values you’ve changed earlier.

OKAY. That’s it. You’re done.

Hallelujah.

My steam name is Teh_Spy.
I changed it along time ago.

If you want to download this achievement that I am using as an example (give me credit if you put it in your add-on or gamemode):
http://www.garrysmod.org/img/?t=dll&id=75809

You can use the achievement example above as a template if you choose.

Cool,if only I knew how to code and where to put this I would try it.

This might help, it’s pretty easy.

Where to put it, not where to code it

He asked both questions. But, your achievements folder is in
achievements\lua\achievements

Why to use code-tags? Use lua-tags instead.

Just wished to mention that you can find out the names for the sweps by getting them from Q menu. If that doesn’t work, the spawn it on the ground. I don’t remember which one said me “Giving Wirusass0 weapon_dexgun” (In case you don’t know dex gun is Ronon’s gun).

I didn’t know how.

I thought everyone knew how to do that, then I remembered how much trouble I had my first time trying to get the correct ID. :lol:

EDIT: Also, It’s the “Give” command.

Updated.