Gamepad

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:19, 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


SOMA provides the Gamepad script in script/effects/Effect_Gamepad.hps.

The Gamepad effect manages controller rumble. Effect_Rumble_Start returns an instance ID, Effect_Rumble_Stop stops that ID, and the screen-shake multiplier controls rumble generated from screen shake.

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_Rumble_Start

Start a gamepad rumble

Parameter Meaning
afAmount strength of the rumble, between 0-1
afTime duration of the rumble
afFadeInTime fade time in the start
afFadeOutTime fade time at the end

In maps/chapter01/01_04_transport_station/01_04_transport_station.hps, SOMA calls Effect_Rumble_Start as follows.

Effect_Rumble_Start(1, 2, 2);
Parameter Value in this stock call
afAmount 1
afTime 2
afFadeInTime 2

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

Effect_Rumble_Stop

Stops the rumble from this id

Parameter Meaning
alID id for the rumble instance, -1 to stop all

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

Effect_Rumble_Stop(mlCrashRumbleId);
Parameter Value in this stock call
alID mlCrashRumbleId

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

Effect_Rumble_SetScreenShakeMul

Sets a multiplier for how much rumble should be generated from screenshake.

Parameter Meaning
afX multiplier to set. 1 is default.

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