<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FScripting%2FVideo_Distortion</id>
	<title>HPL3/SOMA/Scripting/Video Distortion - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FScripting%2FVideo_Distortion"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Video_Distortion&amp;action=history"/>
	<updated>2026-10-04T04:28:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Video_Distortion&amp;diff=7247&amp;oldid=prev</id>
		<title>TiMan: Add a sourced SOMA guide with explanations and stock-script examples.</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Video_Distortion&amp;diff=7247&amp;oldid=prev"/>
		<updated>2026-10-02T12:19:15Z</updated>

		<summary type="html">&lt;p&gt;Add a sourced SOMA guide with explanations and stock-script examples.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{shortPageTitle}}&lt;br /&gt;
&lt;br /&gt;
SOMA provides the Video Distortion script in &amp;lt;code&amp;gt;script/effects/Effect_VideoDistortion.hps&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Before you start ==&lt;br /&gt;
# Open the map script inside your own mod. Keep its generated includes, &amp;lt;code&amp;gt;cScrMap : iScrMap&amp;lt;/code&amp;gt; class and callback structure. See [[HPL3/SOMA/Getting Started/Add Your First Script|Add your first script]] if you have not edited a map script yet.&lt;br /&gt;
# Add the helper include shown below alongside the script’s other includes.&lt;br /&gt;
# 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.&lt;br /&gt;
&lt;br /&gt;
== Follow the stock example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;helpers/helper_effects.hps&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Effect_VideoDistortion_Start ===&lt;br /&gt;
Starts the video distortion effect. If many have been started the max amount is used. Returns ID to this instance.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afAmount&amp;lt;/code&amp;gt; || The amount of effect, 0 - 1 are valid values. (0 turns off)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afTime&amp;lt;/code&amp;gt; || The length the effect (after fade in) the effect should last. -1 means it lasts forever.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFadeInTime&amp;lt;/code&amp;gt; || The time it takes for the effect to fade in.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFadeOutTime&amp;lt;/code&amp;gt; || The time it takes for the effect to fade out.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afVolume&amp;lt;/code&amp;gt; || Volume of gui sound (will override previous instances. Only one sound at a time)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;code&amp;gt;maps/_e3/_e3_01_02/_e3_01_02.hps&amp;lt;/code&amp;gt;, SOMA calls &amp;lt;code&amp;gt;Effect_VideoDistortion_Start&amp;lt;/code&amp;gt; as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Effect_VideoDistortion_Start(0.6, 1,0.5,5);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Value in this stock call&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afAmount&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0.6&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afTime&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFadeInTime&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFadeOutTime&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is an excerpt from that stock script; its referenced names and variables belong to that script.&lt;br /&gt;
&lt;br /&gt;
=== Effect_VideoDistortion_FadeOut ===&lt;br /&gt;
Fades out a video distortion effect instance.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;alID&amp;lt;/code&amp;gt; || id to the instance to fade out. If -1, all instances will be faded.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFadeOutTime&amp;lt;/code&amp;gt; || The time it takes for the effect to fade out.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;code&amp;gt;maps/chapter02/02_02_ms_curie_inside/02_02_ms_curie_inside.hps&amp;lt;/code&amp;gt;, SOMA calls &amp;lt;code&amp;gt;Effect_VideoDistortion_FadeOut&amp;lt;/code&amp;gt; as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Effect_VideoDistortion_FadeOut(-1,1.0);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Value in this stock call&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;alID&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFadeOutTime&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;1.0&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is an excerpt from that stock script; its referenced names and variables belong to that script.&lt;br /&gt;
&lt;br /&gt;
=== Effect_VideoDistortion_SetSoundEffectsDisabled ===&lt;br /&gt;
Set if video distortion sounds should be disabled.&lt;br /&gt;
&lt;br /&gt;
== Check your change ==&lt;br /&gt;
Save the script and restart the map in development mode with &amp;lt;code&amp;gt;F5&amp;lt;/code&amp;gt;. If the script fails, open &amp;lt;code&amp;gt;F1&amp;lt;/code&amp;gt; and use '''Show Error List''' or '''Show HPL Log'''. See [[HPL3/SOMA/Getting Started/Test Debug and Continue|the development loop]] for the launch and debugging steps.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[HPL3/SOMA/Scripting/Effects Helper|SOMA effects helpers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:English]]&lt;/div&gt;</summary>
		<author><name>TiMan</name></author>
		
	</entry>
</feed>