Credits Overview

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


The Credits Handler loads a credits configuration and scrolls its items. Credits_Start selects the configuration and completion callback, while Credits_Stop dismisses the credits screen.

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"

Credits_Start

Starts the credits screen

Parameter Meaning
asCreditsFile path to the cfg file (XML) to read the credits from
asCompleteCallback Callback for when done - void Func()
afRollSpeedStart Starting speed for the credits rolling
afRollSpeedGoal Goal to fade the roll speed to from the starting speed
afRollSpeedFadeTime Time to fade the roll speed

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

Credits_Start("config/Credits.cfg", "OnCreditsComplete",0,0.006f);
Parameter Value in this stock call
asCreditsFile "config/Credits.cfg"
asCompleteCallback "OnCreditsComplete"
afRollSpeedStart 0
afRollSpeedGoal 0.006f

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

Credits_Stop

Dismisses the credits screen

Parameter Meaning
afFadeTime Time to fade out

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

Credits_Stop(0.0f);
Parameter Value in this stock call
afFadeTime 0.0f

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