Map Effects Handler
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.
Contents
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_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.