Game Over Handler

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


The Game Over Handler controls the death screen and checkpoint restart. GameOver_Start supplies the death source, and GameOver_SetCustomGameOverScreenText selects the localized text displayed before reloading the checkpoint.

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_modules.hps"

GameOver_Start

Starts the Game Over screen

In script/player/Player.hps, SOMA calls GameOver_Start as follows.

GameOver_Start(asSource);
Parameter Value in this stock call
asDeathSource asSource

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

GameOver_SetCustomGameOverScreenText

Sets the message that will be displayed before a checkpoint is loaded (after proper death):

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