Map Effects Handler

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:12, 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 Map Effects Handler fades world settings and stores named environment presets. Map_Preset_SetupFog defines the fog portion of a preset; Map_Preset_Fade applies a named preset over a fade duration.

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_map.hps"

Map_Preset_SetupFog

Setup fog for the specified preset

Parameter Meaning
asName Name of the preset
abActive If fog should be active
afStart Where fog starts showing
afEnd Where fog has full effect
afFalloffExp How fast the fog fades to full effect, lower is faster
aColor Color of the fog
afBrightness Brightness of the fog
abUnderwater If underwater fog should be used
abSkybox If fog color should be taken from skybox

In maps/chapter02/02_03_delta/02_03_delta.hps, SOMA calls Map_Preset_SetupFog as follows.

Map_Preset_SetupFog("Outside2.4", true, 0, 25, 0.3, cColor(0.047,0.086,0.098,1), 1, true, true);
Parameter Value in this stock call
asName "Outside2.4"
abActive true
afStart 0
afEnd 25
afFalloffExp 0.3
aColor cColor(0.047,0.086,0.098,1)
afBrightness 1
abUnderwater true
abSkybox true

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

Map_Preset_Fade

Fade in the preset

Parameter Meaning
asName Name of the preset
afFadeTime How long it should take to fade in

In maps/chapter03/03_01_omicron_outside/03_01_omicron_outside.hps, SOMA calls Map_Preset_Fade as follows.

Map_Preset_Fade("Dome", 0.5);
Parameter Value in this stock call
asName "Dome"
afFadeTime 0.5

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

Map_FadeFogColor

In maps/chapter05/05_01_phi_inside/05_01_phi_inside.hps, SOMA calls Map_FadeFogColor as follows.

Map_FadeFogColor(cColor(0),8.0f);
Parameter Value in this stock call
aTarget cColor(0)
afTime 8.0f

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