Created
January 27, 2018 22:03
-
-
Save Aerodos12/8f818982b5921b95699c81e242542423 to your computer and use it in GitHub Desktop.
Achievement System
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Achievement = {} | |
local RemoteService = require(game.ReplicatedStorage.RemoteService) | |
local ProgressionService = require(game.ReplicatedStorage.ProgressionService) | |
Achievement.__index = Achievement | |
function Achievement.new(...) | |
local ach = {} | |
local args = {...} | |
ach.Name = args[1] | |
ach.Desc = args[2] | |
ach.DescBeforeCompleted = args[3] | |
ach.onBadgeGet = args[4] | |
ach.questionMarks = args[5] | |
ach.Completed = false | |
ach.TrophyName = args[6] | |
ach.Level = args[7] | |
ach.Player = nil | |
return setmetatable(ach,Achievement) | |
end | |
function Achievement:ToReplicatedAchievement() | |
local ach = {} | |
ach.Name =self.Name | |
ach.Desc = self.Desc | |
ach.DescBC = self.DescBeforeCompleted | |
ach.QMarks = self.questionMarks | |
ach.Completed = self.Completed | |
ach.Trophy = self.TrophyName | |
return ach | |
end | |
function Achievement:SetPlr(plr) | |
self.Player = plr | |
end | |
function Achievement:__tostring() | |
return self.Name | |
end | |
function Achievement:Activate() | |
self.onBadgeGet(self.Player) | |
RemoteService.send("Client",self.Player,"NotifyAchievement",self.Name,self.Level) | |
ProgressionService:AddXP(self.Player,20,"achievement_completed") | |
self.Completed = true | |
end | |
return Achievement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Achievement = require(game.ReplicatedStorage.Achievement) | |
local Achievements = { | |
Achievement.new("Quartet of Double Kills - A280","Got 4 double kills with the A280","Get 4 double kills with the A280",function() | |
end,true,"A280Bronze",1); | |
Achievement.new("Quartet of Double Kills II - A280","Got 8 double kills with the A280","Get 8 double kills with the A280",function() | |
end,true,"A280Silver",2); | |
Achievement.new("Quartet of Double Kills III - A280","Got 12 double kills with the A280","Get 12 double kills with the A280",function() | |
end,true,"A280Gold",3); | |
Achievement.new("KO Time I","Got 5 PURE KOs.","Get 5 PURE KOs.",function() | |
end,true,"KOBronze",1); | |
Achievement.new("KO Time II","Got 10 PURE KOs","Get 10 PURE KOs ",function() | |
end,true,"KOSilver",2); | |
Achievement.new("KO Time III","Got 25 PURE KOs","Get 25 PURE KOs ",function() | |
end,true,"KOGold",3); | |
Achievement.new("KO Time IV","Got 50 PURE KOs.","Get 50 PURE KOs.",function() | |
end,true,"KOBronze2",1); | |
Achievement.new("KO Time V","Got 100 PURE KOs","Get 100 PURE KOs ",function() | |
end,true,"KOSilver2",2); | |
Achievement.new("KO Time VI","Got 250 PURE KOs","Get 250 PURE KOs ",function() | |
end,true,"KOGold2",3); | |
Achievement.new("KO Time VII","Got 500 PURE KOs.","Get 500 PURE KOs.",function() | |
end,true,"KOBronze3",1); | |
Achievement.new("KO Time VIII","Got 750 PURE KOs","Get 750 PURE KOs ",function() | |
end,true,"KOSilver3",2); | |
Achievement.new("KO Time IX","Got 1000 PURE KOs","Get 1000 PURE KOs ",function() | |
end,true,"KOGold3",3); | |
Achievement.new("KO Time X","Got 1250 PURE KOs.","Get 1250 PURE KOs.",function() | |
end,true,"KOBronze4",1); | |
Achievement.new("KO Time XI","Got 1500 PURE KOs","Get 1500 PURE KOs ",function() | |
end,true,"KOSilver4",2); | |
Achievement.new("KO Time XII","Got 2000 PURE KOs","Get 2000 PURE KOs ",function() | |
end,true,"KOGold4",3); | |
Achievement.new("Headshot Spree I","Got 5 Headshots","Get 5 Headshots ",function() | |
end,true,"CranialBronze",3); | |
} | |
return Achievements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment