Player Energy Handler

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


The Player Energy Handler manages energy-drain and recharge interaction and exposes movement and look multipliers. Player scripts multiply their speeds by these values. The module also has switches for flower swallowing and Catherine’s recharge comments.

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"

PlayerEnergy_GetMoveMul

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

PlayerEnergy_GetMoveMul();

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

PlayerEnergy_GetLookMul

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

PlayerEnergy_GetLookMul();

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

PlayerEnergy_SetFlowerSwallows

In maps/chapter05/05_01_phi_inside/05_01_phi_inside.hps, SOMA calls PlayerEnergy_SetFlowerSwallows as follows.

PlayerEnergy_SetFlowerSwallows(true);
Parameter Value in this stock call
abX true

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