Effects Interfaces

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:21, 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


The SOMA script declarations for this interface reference are in script/effects/Effects.hps.

Effect base and typed interfaces separate the native effect object from effect-specific operations. The Shake helper retrieves the effect by eEffect_Shake, casts it to iScrEffect_Shake and calls Start; the returned ID identifies the shake instance.

Classes and interfaces

shared interface iScrEffect_Shake
shared interface iScrEffect_Fade
shared interface iScrEffect_FadeProperty
shared interface iScrEffect_ToneMapping
shared interface iScrEffect_DepthOfField
shared interface iScrEffect_Flash
shared interface iScrEffect_ImageTrail
shared interface iScrEffect_ChromaticAberration
shared interface iScrEffect_Screen
shared interface iScrEffect_RadialBlur
shared interface iScrEffect_VideoDistortion
shared interface iScrEffect_ImageFadeFX
shared interface iScrEffect_TimeGlitch
shared interface iScrEffect_Sway
shared interface iScrEffect_Gamepad

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_Shake_Start

Makes the screen shake for a certain amount of time. Returns id to the current shaking. If several calls to shake has been made the largest one is used.

Parameter Meaning
afAmount The strength of the shake.
afTime The time it shakes at full intensity (fade in and fade out are added to this).
afFadeInTime The time before it reaches full strength.
afFadeOutTime The time, after afTime is up, that it will take for the shake to reach zero strength.
avDirAmount The amount it will shake in each direction in camera space
afFrequency Times per seconds the shake will change offset. 0=every update (ie max).

In maps/chapter02/02_04_theta_outside/02_04_theta_outside.hps, SOMA calls Effect_Shake_Start as follows.

Effect_Shake_Start(0.2, 2, 12, 0);
Parameter Value in this stock call
afAmount 0.2
afTime 2
afFadeInTime 12
afFadeOutTime 0

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