LuaLibraryAchievements.wiki
author Wuzzy
Wed, 17 Apr 2019 00:19:05 +0100
changeset 1735 4b658d116488
parent 1488 a955f982d72a
permissions -rw-r--r--
Sandbox: Edited via web interface

#summary Lua library documentation of Achievements; contains assorted helper functions
#labels !LuaLibrary
= Lua library: `Achievements` =
*WARNING*: The achievements system is still very bare bones. It might be subject to major changes in future. This library should only be used internally by Hedgewars at this point.

This is simple library for awarding an achievement to the player, to be used in missions. They are not meant for multiplayer.

An achievement in Hedgewars is a simple award given for doing something awesome or difficult in a mission, or winning a mission in a great way.
Achievements are a hidden feature in Hedgewars so far and far from complete.

One existing achievement in Hedgewars is “Lively Lifeguard” in the scenario “That Sinking Feeling” which is awarded for rescuing all hogs.

== `awardAchievement(name, statMessage, capgrp)` ==
Awards an achievement with name `name` to player.

Currently, this only displays a caption and adds a mention in the stat screen.

Parameters:

 * `name`: Name of achievement.
 * `statMessage`: Optional. If set as string, this text will be shown in the stats screen. If `nil`, a default text is used.
 * `capgrp`: Optional. Caption group of `AddCaption` to be used. Default is `capgrpMessage2`. If `false`, no caption is shown.

For consistent style, treat the name like a title is written in the English language. Good: “Naughty Ninja”. Bad: “naughty ninja”.