Time Glitch

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


SOMA provides the Time Glitch script in script/effects/Effect_TimeGlitch.hps.

Time glitch jumps physics and visuals forward in time and temporarily speeds up sounds. Its arguments select the amount of time advanced, the time sounds run faster, the shake amount, whether an effect sound plays and that sound’s volume.

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_TimeGlitch_Start

Starts an effect that makes physics and visual jump forward in time.

Parameter Meaning
afTimeAdvancement The amount of time physics and visuals should advance.
afPlayFastSoundTime How long the sounds should run sped up. (sound freq depends on the time advancement + this time)
afShakeAmount How much the screen should shake.
abPlayEffectSound If an effect sound should play.
afSoundEffectVolume Volume of the sound being played.

In maps/chapter01/01_04_transport_station/01_04_transport_station.hps, SOMA calls Effect_TimeGlitch_Start as follows.

Effect_TimeGlitch_Start(2, 0.5, 0.2, true);
Parameter Value in this stock call
afTimeAdvancement 2
afPlayFastSoundTime 0.5
afShakeAmount 0.2
abPlayEffectSound 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.

Read the example

In the transport-station example, physics and visuals advance by 2, sounds run sped up for 0.5, the shake amount is 0.2 and the effect sound is enabled. The omitted sound-volume argument uses the declaration’s 1.0f default. These arguments describe one glitch; they do not define a repeating interval.

See also