# HG changeset patch
# User Wuzzy
# Date 1519134853 0
# Node ID 64b95a681971c1b70a166a40a5214615dfdff1b2
# Parent 90c14fae29f287ffb822282f9e225d29a45875a4
LuaAPI: Add onAchievementsDeclaration and DeclareAchievement
diff -r 90c14fae29f2 -r 64b95a681971 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 ==
=== !AddGear(x, y, gearType, state, dx, dy, timer) ===
@@ -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.
+
=== !ParseCommand(string) ===
Makes the game client parse and execute the specified internal game engine command.