LuaAPI: Add onAchievementsDeclaration and DeclareAchievement
authorWuzzy
Tue, 20 Feb 2018 13:54:13 +0000
changeset 1225 64b95a681971
parent 1224 90c14fae29f2
child 1226 971427650f1f
LuaAPI: Add onAchievementsDeclaration and DeclareAchievement
LuaAPI.wiki
--- a/LuaAPI.wiki	Tue Feb 20 13:42:14 2018 +0000
+++ b/LuaAPI.wiki	Tue Feb 20 13:54:13 2018 +0000
@@ -384,6 +384,9 @@
 
 This function is used in Racer and !TechRacer to define waypoints.
 
+=== `onAchievementsDeclaration()` ===
+This function is called after the stats have been built. You are supposed to call `DeclareAchivement` here.
+
 == Functions for creating gears ==
 
 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> ===
@@ -1427,6 +1430,18 @@
 === `StartGhostPoints(count)` ===
 Just prints out “GHOST_POINTS” and the argument on the console. This function might change in later versions.
 
+=== `DeclareAchivement(id, teamname, location, value)` ===
+Declares an achievement with the identifier `id` achieved by the team `teamname` on the map `location` with an achievement value (e.g. score) of `value`. `value` must be an integer. You are supposed to call this function inside an `onAchievementsDeclaration` callback.
+
+Currently, this actually just triggers a console output, but it might be changed later. The idea is to track multiplayer records.
+
+Example:
+
+```
+DeclareAchievement("height reached", teamname, "ClimbHome", -score)
+```
+Records a team's best height in !ClimbHome.
+
 === <tt>!ParseCommand(string)</tt> ===
 Makes the game client parse and execute the specified internal game engine command.