Areas
The SOMA script declarations for this interface reference are in script/interfaces/Area_Interface.hps.
Area scripts inherit iScrArea to access the native cLuxArea through mBaseObj. SetupBaseInterface stores that handle and GetBase returns it. Specialized area helpers operate on the area’s behavior, such as moving ordinary areas or attaching objects to sticky areas.
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.
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.