- This library attempts to make it an easy task to add achievements to any mod, and have them all be displayed neatly in the same window without conflict.
Example Mod - a working mod (using achievements v0.1.0) providing examples on how to use library.
- Place the extracted folder into your mod so it looks like this:
/ITB/mods/.../scripts/achievements/
- Request library: Must be requested at least once at init, and can then be requested and used at any time later in other files.
Code: Select all
local achvApi = require(self.scriptPath .."achievements/api")
Most likely to be used functions: (see achievements/api for more functions)
Code: Select all
achvApi:AddChievo(chievo) ========================= adds an achievement for your mod. chievo is a table with the following fields: field | type | description ----------+--------+--------------------------------------------------------- id | string | identifier within your mod. name | string | display title. tip | string | tooltip text. (see example mod) img | string | path to image. objective | table | optional field for multipart chievos. (see example mod) ----------+--------+--------------------------------------------------------- achvApi:TriggerChievo(chievoId, objectives) =========================================== modifies an achievement's progress. objectives = nil -> completed objectives = true -> completed objectives = false -> incomplete objective is a table -> sets progress according to progress table. field | type | description ------------+---------+-------------------- objectives | boolean | true, false or nil objectives | table | progress table ------------+---------+--------------------