Effects Interfaces
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.
Contents
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
- Open the map script inside your own mod. Keep its generated includes,
cScrMap : iScrMapclass and callback structure. See Add your first script if you have not edited a map script yet. - Add the helper include shown below alongside the script’s other includes.
- 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.