LuaLibraryAchievements.wiki
author Wuzzy
Fri, 12 May 2023 14:37:17 +0000
changeset 2223 4e49d93377fd
parent 1488 a955f982d72a
permissions -rw-r--r--
LuaEvents: Rewrite onNewAmmoStore help
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1484
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     1
#summary Lua library documentation of Achievements; contains assorted helper functions
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     2
#labels !LuaLibrary
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
= Lua library: `Achievements` =
1486
4984ebed9535 LuaLibraryAchievements: formatting
Wuzzy
parents: 1485
diff changeset
     4
*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.
1484
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     5
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
This is simple library for awarding an achievement to the player, to be used in missions. They are not meant for multiplayer.
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
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.
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
Achievements are a hidden feature in Hedgewars so far and far from complete.
1487
1800c3c11a33 LuaLibraryAchievements: grammar
Wuzzy
parents: 1486
diff changeset
    10
1800c3c11a33 LuaLibraryAchievements: grammar
Wuzzy
parents: 1486
diff changeset
    11
One existing achievement in Hedgewars is “Lively Lifeguard” in the scenario “That Sinking Feeling” which is awarded for rescuing all hogs.
1484
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
1488
a955f982d72a LuaLibraryAchievements: rename params
Wuzzy
parents: 1487
diff changeset
    13
== `awardAchievement(name, statMessage, capgrp)` ==
1484
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
    14
Awards an achievement with name `name` to player.
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
    16
Currently, this only displays a caption and adds a mention in the stat screen.
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
1486
4984ebed9535 LuaLibraryAchievements: formatting
Wuzzy
parents: 1485
diff changeset
    18
Parameters:
4984ebed9535 LuaLibraryAchievements: formatting
Wuzzy
parents: 1485
diff changeset
    19
4984ebed9535 LuaLibraryAchievements: formatting
Wuzzy
parents: 1485
diff changeset
    20
 * `name`: Name of achievement.
1488
a955f982d72a LuaLibraryAchievements: rename params
Wuzzy
parents: 1487
diff changeset
    21
 * `statMessage`: Optional. If set as string, this text will be shown in the stats screen. If `nil`, a default text is used.
1486
4984ebed9535 LuaLibraryAchievements: formatting
Wuzzy
parents: 1485
diff changeset
    22
 * `capgrp`: Optional. Caption group of `AddCaption` to be used. Default is `capgrpMessage2`. If `false`, no caption is shown.
1484
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
    23
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents:
diff changeset
    24
For consistent style, treat the name like a title is written in the English language. Good: “Naughty Ninja”. Bad: “naughty ninja”.