Achievement Types

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


The eAchievement enum supplies the IDs used by SOMA’s achievement calls. The enum values are identifiers rather than display strings; Achievement_GetName, Achievement_GetDisplayName and Achievement_GetDescription query the handler for associated text.

SOMA declares eAchievement in script/base/AchievementHandler_Types.hps.

shared enum eAchievement
{
	eAchievement_CathCall,		
	eAchievement_ChasedCath,	
	eAchievement_Stranded,		
	eAchievement_Dunbat,		
	eAchievement_PlanB,			
	eAchievement_Dream,			
	eAchievement_NewYou,		
	eAchievement_LastHuman,		
	eAchievement_Expressway,	
	eAchievement_TheEnd,		
}

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