Areas Helper
The Areas helper file in SOMA is script/helpers/helper_areas.hps.
Area helpers move areas and operate on specialized area behavior such as doorway groups, liquids, sticky attachments and camera-animation nodes. Ordinary area movement excludes liquid areas, which have their own movement helper.
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_areas.hps"
Area_MoveLinearTo
Moves the specified area to the current position of the target entity. !Does not work on Liquid Areas, instead use LiquidArea_MoveLinearTo!
| Parameter | Meaning |
|---|---|
asName |
name of the area to move, wildcard(s) * are supported. |
asTargetEntity |
name of the entity to move the area to. |
afAcceleration |
acceleration .in m/s^2 |
afMaxSpeed |
the maximum speed of movement. |
afSlowDownDist |
the distance at which movement slows down. |
abResetSpeed |
if all static movement for the area should be stopped before starting this movement. |
asCallback |
callback when movement is done: void asCallback(const tString& in asAreaName) |
In maps/_e3/_e3_01_01/_e3_01_01.hps, SOMA calls Area_MoveLinearTo as follows.
Area_MoveLinearTo("RunningSoundSource","RunningSoundSource_Target",2.2f,5.0f);
| Parameter | Value in this stock call |
|---|---|
asName |
"RunningSoundSource"
|
asTargetEntity |
"RunningSoundSource_Target"
|
afAcceleration |
2.2f
|
afMaxSpeed |
5.0f
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
LiquidArea_MoveLinearTo
Moves the specified liquid area to the current position of the target entity.
| Parameter | Meaning |
|---|---|
asName |
name of the liquid area to move, wildcard(s) * are supported. |
asTargetEntity |
name of the entity to move the liquid area to. |
afAcceleration |
acceleration .in m/s^2 |
afMaxSpeed |
the maximum speed of movement. |
afSlowDownDist |
the distance at which movement slows down. |
abResetSpeed |
if all static movement for the liquid area should be stopped before starting this movement. |
asCallback |
callback when movement is done: void asCallback(const tString& in asAreaName) |
In maps/chapter02/02_04_theta_outside/02_04_theta_outside.hps, SOMA calls LiquidArea_MoveLinearTo as follows.
LiquidArea_MoveLinearTo("LiquidArea_1", "LiquidArea_1_Target", 1, 1, 0.25);
| Parameter | Value in this stock call |
|---|---|
asName |
"LiquidArea_1"
|
asTargetEntity |
"LiquidArea_1_Target"
|
afAcceleration |
1
|
afMaxSpeed |
1
|
afSlowDownDist |
0.25
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
StickyArea_AttachEntity
Attaches an entity to a sticky area. The entity must have a physics body.
| Parameter | Meaning |
|---|---|
asArea |
name of sticky area. |
asEntity |
name of entity. |
asBody |
name of specific body on entity, if left as an emtpy string, the main body will be used. |
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.