Achievement Handler

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Jump to navigation Jump to search


The SOMA script declarations for this interface reference are in script/interfaces/AchievementHandler_Interface.hps.

The Achievement Handler creates and registers the game’s achievement records. Map scripts call Achievement_Unlock with an eAchievement value; the game helper forwards that value to UnlockAchievement on the native handler.

Before you start

  1. Open the map script inside your own mod. Keep its generated includes, cScrMap : iScrMap class and callback structure. See Add your first script if you have not edited a map script yet.
  2. Add the helper include shown below alongside the script’s other includes.
  3. Read the stock example before copying its calls: named entities, voice subjects, materials and callbacks must belong to the map or resources you are using.

Follow the stock example

#include "helpers/helper_game.hps"

Achievement_Unlock

In maps/chapter03/03_01_omicron_outside/03_01_omicron_outside.hps, SOMA calls Achievement_Unlock as follows.

Achievement_Unlock(eAchievement_Dream);
Parameter Value in this stock call
alID eAchievement_Dream

This is an excerpt from that stock script; its referenced names and variables belong to that script.

Check your change

Save the script and restart the map in development mode with F5. If the script fails, open F1 and use Show Error List or Show HPL Log. See the development loop for the launch and debugging steps.

See also