Props Helper

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:09, 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 Props helper file in SOMA is script/helpers/helper_props.hps.

Prop helpers include opening swing doors with impulses, querying the grabbed prop and setting selected entities’ interaction icons. Grab_GetGrabbedProp returns null when no prop is grabbed.

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

SwingDoor_PushOpen

Pushes a door open using one or many impulses

Parameter Meaning
asName name of the door.
afImpulseAmount Amount of impulse that will be applied to the door.
alNumOfTimes Number of times the impulse will be applied.
afTimeBetweenPushes Pause interval between two impulses.

In maps/chapter04/04_02_tau_inside/04_02_tau_inside.hps, SOMA calls SwingDoor_PushOpen as follows.

SwingDoor_PushOpen(asTimer, 0.02, 90,0.2);
Parameter Value in this stock call
asName asTimer
afImpulseAmount 0.02
alNumOfTimes 90
afTimeBetweenPushes 0.2

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

Grab_GetGrabbedProp

Returns the currently grabbed prop, or null if there isn't one.

In script/props/Prop_Grab.hps, SOMA calls Grab_GetGrabbedProp as follows.

cLuxProp@ pProp = Grab_GetGrabbedProp();

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

Entity_SetCustomInteractIcon

Sets the interaction icon for an entity. Currently only works for MoveBody, MoveableButton, Lever, Rigid and Triggers.

Parameter Meaning
asName name of the entity.
aIcon The interaction icon.

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