Achievements are stored records of the player’s past deeds. You don’t have to add achievements to your game, but many players do enjoy them.
Be sure to read our basic ChoiceScript Introduction page first.
When you use an
*ifid and export your game to HTML, the HTML file will store your progress, checkpoints, and achievements in the user’s browser. Achievements, once activated, will remain permanently activated, even if the player uses the menu to restart their game.
But when you just run the ChoiceScript server and refresh the page, the game forgets everything that’s ever happened, including forgetting all achievements.
If you do ultimately decide to publish your game with us, we’ll publish your achievements on Apple, Google, and Steam, permanently storing them in the player’s account.
Each achievement is worth a certain number of “points;” each game has a total of 1000 points to distribute across all achievements. Each game can have a maximum of 100 achievements; no individual achievement can reward more than 100 points.
Scarcer high-value achievements are more visible to players’ friends, so we recommend having at least one achievement worth 100 points.
This is made trickier by the fact that we’re not allowed to change achievements after Apple, Google, and Steam have approved them. The stores recommend that we avoid spending all of our “point budget” on the initial version of your game, and instead save some of the budget to support updates and new content.
Achievements are defined at the top of
startup.txt, alongside the
*create commands, like this:
*achievement lover visible 50 I'm a Lover, Not a Fighter Romance the dragon without killing it. *achievement dragonslayer visible 100 Dragon Slayer Who is the greatest dragon in the kingdom? Kill the dragon Axilmeus. *achievement secret hidden 50 Discovered the Secret hidden Discover the secret hidden within the dragon's lair.
*achievement line includes the short name, visibility, points, and title of the achievement. The next indented line includes the pre-earned description (or the word “hidden” if the achievement is hidden). The next indented line is the post-earned description, if there is one.
The order of achievements matters. The order in which you write the *achievement commands is the order in which they’ll be displayed in the achievements list.
You can give the player an achievement using the achievement’s short name, like this:
The player will see a banner, like this:
Achievement: Dragon Slayer
Kill the dragon.
(On iOS, it will cause a Game Center achievement banner instead, which will only display the title of the achievement.)
*check_achievements command creates temp variables named “
choice_achieved_dragonslayer“, which you can use to detect whether the player has activated an achievement.
You can use
*check_achievements to unlock content for players who have reached a certain achievement.
*check_achievements *if choice_achieved_dragonslayer You killed the dragon! (Perhaps in a previous playthrough.) Here's a nifty secret...
You can also use
*check_achievements to activate meta-achievements, achievements that activate when you’ve activated other achievements.
*check_achievements *if choice_achieved_dragonslayer and choice_achieved_lover *achieve dragonmaster
Please post on the ChoiceScript forum if you have questions about achievements.