Screen

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:23, 2 October 2026 by TiMan (talk | contribs) (Add a sourced SOMA guide with explanations and stock-script examples.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


This page describes SOMA’s Screen effect.

Screen effects draw a material over the screen. One Start overload leaves the image active for manual fading; the other gives it fade-in, hold and fade-out times. The source explicitly requires images that work at both 4:3 and 16:9 aspect ratios.

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

Effect_Screen_Start: manual fading

Creates a images that shows up on the screen, it must be faded manually Remember that these must work on both 4:3 and 16:9 aspect ratio

Parameter Meaning
asMaterial material to use
avPosition position on the screen, values between [0,1]
avSize size of the texture

Effect_Screen_Start: timed image

Creates a images that fade in and then out Remember that these must work on both 4:3 and 16:9 aspect ratio

Parameter Meaning
asMaterial material to use
avPosition position on the screen, values between [0,1]
avSize size of the texture
afTargetAlpha alpha it should stop fading at
afFadeInTime how fast it should fade in
afStayTime how long it should stay after fading in
afFadeOutTime how fast it should fade out again

In maps/_e3/_e3_01_02/_e3_01_02.hps, SOMA calls Effect_Screen_Start as follows.

Effect_Screen_Start("water_splash_screen.mat", cVector2f(0.5, 0.5), cVector2f(1.8, 1.8), 1, 0.4f, 0.2f, 0.6f);
Parameter Value in this stock call
asMaterial "water_splash_screen.mat"
avPosition cVector2f(0.5, 0.5)
avSize cVector2f(1.8, 1.8)
afTargetAlpha 1
afFadeInTime 0.4f
afStayTime 0.2f
afFadeOutTime 0.6f

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

Effect_Screen_FadeAlpha

Fades the transparency of a material

Parameter Meaning
alID id of the screen material
afAlpha transparency of the material value between [0,1]
afFadeTime time to fade over

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