Video Distortion

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


SOMA provides the Video Distortion script in script/effects/Effect_VideoDistortion.hps.

Video distortion has direct and timed-instance controls. The largest amount is used when several instances are active; helpers can change an instance’s maximum amount or disable distortion sounds.

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_VideoDistortion_Start

Starts the video distortion effect. If many have been started the max amount is used. Returns ID to this instance.

Parameter Meaning
afAmount The amount of effect, 0 - 1 are valid values. (0 turns off)
afTime The length the effect (after fade in) the effect should last. -1 means it lasts forever.
afFadeInTime The time it takes for the effect to fade in.
afFadeOutTime The time it takes for the effect to fade out.
afVolume Volume of gui sound (will override previous instances. Only one sound at a time)

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

Effect_VideoDistortion_Start(0.6, 1,0.5,5);
Parameter Value in this stock call
afAmount 0.6
afTime 1
afFadeInTime 0.5
afFadeOutTime 5

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

Effect_VideoDistortion_FadeOut

Fades out a video distortion effect instance.

Parameter Meaning
alID id to the instance to fade out. If -1, all instances will be faded.
afFadeOutTime The time it takes for the effect to fade out.

In maps/chapter02/02_02_ms_curie_inside/02_02_ms_curie_inside.hps, SOMA calls Effect_VideoDistortion_FadeOut as follows.

Effect_VideoDistortion_FadeOut(-1,1.0);
Parameter Value in this stock call
alID -1
afFadeOutTime 1.0

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

Effect_VideoDistortion_SetSoundEffectsDisabled

Set if video distortion sounds should be disabled.

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