User Tools

Site Tools


Sidebar

hpl3:community:scripting:script_functions

Engine Scripts

Basic Code

This page is here as a reference documentation available online covering the main script functions within HPL3. These are the ones included by default and are found within the hps_api.hps file located in the SOMA game directory.

This is a work-in-progress page. In time, it will contain much more than just the helpers.

Entity

bool Entity_Exists(const tString &in asName);
bool Entity_Exists(tID aID);

Check if an entity exists in the level. Returns true if found.

asName - the name of the entity to search for.
OR
aID - the ID of the entity to search for.

bool Entity_SetActive(const tString &in asName, bool abActive);

Set whether an entity is active (visible and functioning) or not.

asName - the name of the entity (wildcards (*) are supported).
abActive - if active or not.

bool Entity_IsActive(const tString &in asName);

Check if an entity is active (visible and functioning) or not.

asName - the name of the entity (wildcards (*) are supported).

void Entity_SetInteractionDisabled(const tString &in asEntityName,  bool abX);

Sets whether an entity can be interacted with by the player or not.

asEntityName - the name of the entity (wildcards (*) are supported).
abX - true = interaction disabled | false = interaction enabled.

void Entity_SetMaxInteractionDistance(const tString &in asEntityName,  float afDistance);

Override the default max distance an entity can be interacted with.

asEntityName - the name of the entity (wildcards (*) are supported).
afDistance - the distance (in meters) the entity can be interacted with from.

bool Entity_IsInteractedWith(const tString &in asName);

Checks whether an entity is being interacted with.

asName - the name of the entity.

void Entity_Sleep(const tString &in asName);

Forces the entity to sleep. This disables Update and PostUpdate. Has no effect if entity is already sleeping.

asName - the name of the entity (wildcards (*) are supported).

void Entity_WakeUp(const tString &in asName);

Wakes a sleeping entity. This enabled Update and PostUpdate. Has no effect if entity is already awake.

asName - the name of the entity (wildcards (*) are supported).

bool Entity_IsSleeping(const tString &in asName);

Checks whether an entity is asleep.

asName - the name of the entity.

void Entity_SetAutoSleep(const tString &in asName,  bool abX);

Sets whether an entity should automatically sleep when it doesn't require updates.

asName - the name of the entity (wildcards (*) are supported).
abX - enabled or disabled.

bool Entity_GetAutoSleep(const tString &in asName);

Gets whether an entity automatically goes to sleep when it doesn't require updates.

asName - the name of the entity.

void Entity_SetIsOccluder(const tString &in asName,  bool abOccluder);

Set whether an entity is an occluder.

asName - the name of the entity (wildcards (*) are supported).
abOccluder - enabled or disabled.

bool Entity_IsOccluder(const tString &in asName);

Checks whether an entity is an occluder.

asName - the name of the entity.

void Entity_SetVarString(const tString&in asEntityName, const tString&in asVarName, const tString&in asX);
void Entity_SetVarBool(const tString&in asEntityName, const tString&in asVarName, bool abX);
void Entity_SetVarInt(const tString&in asEntityName, const tString&in asVarName, int alX);
void Entity_SetVarFloat(const tString&in asEntityName, const tString&in asVarName, bool afX);
void Entity_SetVarVector2f(const tString&in asEntityName, const tString&in asVarName, const cVector2f&in avX);
void Entity_SetVarVector3f(const tString&in asEntityName, const tString&in asVarName, const cVector3f&in avX);
void Entity_SetVarColor(const tString&in asEntityName, const tString&in asVarName, const cColor&in aX);

Sets a value of an entity variable.

asName - the name of the entity (wildcards (*) are supported).
asVarName - the name of the variable for the entity.
aX - the value of the variable.

void Entity_IncVarInt(const tString&in asEntityName,  const tString&in asVarName,  int alX);
void Entity_IncVarFloat(const tString&in asEntityName,  const tString&in asVarName,  float afX);
void Entity_IncVarVector2f(const tString&in asEntityName,  const tString&in asVarName,  const cVector2f&in avX);
void Entity_IncVarVector3f(const tString&in asEntityName,  const tString&in asVarName,  const cVector3f&in avX);

Increments a value of an entity variable.

asName - the name of the entity (wildcards (*) are supported).
asVarName - the name of the variable for the entity.
aX - the value to add.

tString Entity_GetVarString(const tString&in asEntityName,  const tString&in asVarName);
bool Entity_GetVarBool(const tString&in asEntityName,  const tString&in asVarName);
int Entity_GetVarInt(const tString&in asEntityName,  const tString&in asVarName);
float Entity_GetVarFloat(const tString&in asEntityName,  const tString&in asVarName);
cVector2f Entity_GetVarVector2f(const tString&in asEntityName,  const tString&in asVarName);
cVector3f Entity_GetVarVector3f(const tString&in asEntityName,  const tString&in asVarName);
cColor Entity_GetVarColor(const tString&in asEntityName,  const tString&in asVarName);

Gets the value of an entity variable.

asName - the name of the entity.
asVarName - the name of the variable for the entity.

Helper Files

Helper files are seperate .hps files which contain many further functions and codes which are of use to the developer. The following are grouped by their helper file name. In order to use these, you need to specify with an #include <helper.hps> at the top of your code, which is done automatically when you save your map for the first time. These codes are found in SOMA/script/helpers/ , and are grouped on this page under which one you require. To search this, from most browsers, you can press Ctrl+F and start typing in a term.

A.I

The following codes require #include “helpers/helper_ai.hps”.

void Agent_FaceEntity(const tString &in asAgentName, const tString &in asLookAtTarget);

Instantly sets the yaw of the agent to make it look at the specified entity.

asAgentName - Name of the agent. Wildcard (*) supported.
asLootAtTarget - Name of entity to look at.

bool Agent_PlayerDetected(const tString &in asAgentName);

Gets if the player has been detected by an agent. Returns true if so.

asAgentName - Name of the agent. Wildcard (*) supported.

void Agent_RevealPlayerPosition(const tString &in asAgentName, bool bForceRedetect=false);

Reveals the player's current position to the agent.

asAgentName - name of the agent. Wildcard (*) supported.

void Agent_SetAutoDisableCallback(const tString &in asAgentName, const tString &in asCallbackFunc);

Sets the function that is called when the disabling made by Agent_SetAutoDisableWhenOutOfSightActive(); happens

asAgentName - name of the agent. Wildcard (*) supported.
asCallbackFunc - Function called when the disabling happens.
Callback syntax: void MyFunc(const tString&in asEntityName)

void Agent_SetAutoDisableWhenOutOfSightActive(const tString &in asAgentName, bool abActive, float afMinDistance);

When active, the agent will be a disabled (SetActive(false)) when a certain distance away from the player and no longer seen.

asAgentName - name of the agent.Wildcard (*) supported.
abActive - if the disabling is active (should be disabled = true)
afMinDistance - The minimum distance from the player for this to happen.

void Agent_SetSensesActive(const tString &in asAgentName, bool abX);

Set if the agent should have its senses (hearing/vision/etc) enabled.

asAgentName - name of the agent. Wildcard (*) supported.
abX - If the senses should be active.

void Agent_SetStaticCollider(const tString &in asAgentName, bool abX);

Set if the agent will collide with the environment (objects and stuff will still collide with it!)

asAgentName - name of the agent. Wildcard (*) supported.
abX - If the character should be static and NOT move about.

void Agent_SetViewRangeMul(const tString &in asAgentName, float afRangeMul);

Sets the view range multiplier of the specified agent

asAgentName - name of the agent. Wildcard (*) supported.
afRangeMul - the range multiplier to set.

void Agent_TeleportFeetToEntity(const tString &in asAgentName, const tString &in asTargetName);

Teleport the agent's foot position to a specific other entity.

asAgentName - name of the entity to teleport.
asTargetName - name of the entity to teleport to.

hpl3/community/scripting/script_functions.1445778678.txt.gz · Last modified: 2015/10/25 13:11 by romulator