HPL3/Amnesia: Rebirth/Scripting/Scripting Api/Entity

From Frictional Wiki
< HPL3‎ | Amnesia: Rebirth‎ | Scripting‎ | Scripting Api
Revision as of 00:03, 16 November 2020 by Abion47 (talk | contribs) (Created page with "{{ScriptingStub}} Have some helpful descriptions to add to this class? Edit this page and add your insight to the Wiki! ==Summary== {{CodeDocSummaryTop}} {{CodeDocSummaryIte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Have some helpful descriptions to add to this class? Edit this page and add your insight to the Wiki!

Contents

Summary

Return Type Function and Description
bool Entity_AddCollideCallback(const tString &in asParentName, const tString &in asChildName, const tString &in asFunction)
Add a callback for when entities (objects, areas etc) collide and/or collides with the player
void Entity_AddForce(const tString &in asEntityName, const cVector3f &in avForce, bool abLocalSpace, bool abOnlyMainBody)
Adds force to the entity
void Entity_AddForceFromEntity(const tString &in asEntityName, const tString &in asForceEntityName, float afForce, bool abOnlyMainBody)
Adds force to the entity away from another entity
void Entity_AddImpulse(const tString &in asEntityName, const cVector3f &in avImpulse, bool abLocalSpace, bool abOnlyMainBody)
Adds an impulse to the entity
void Entity_AddImpulseFromEntity(const tString &in asEntityName, const tString &in asImpulseEntityName, float afImpulse, bool abOnlyMainBody)
Adds an impulse to the entity away from another entity
void Entity_AddTorque(const tString &in asEntityName, const cVector3f &in avTorque, bool abLocalSpace, bool abOnlyMainBody)
Adds torque to an entity to provide some angular velocity
bool Entity_AttachToEntity(const tString &in asName, const tString &in asParentName, const tString &in asParentBodyName, bool abUseRotation, bool abSnapToParent = false, bool abLocked = false)
Attaches the entity to another entity
bool Entity_AttachToSocket(const tString &in asName, const tString &in asParentName, const tString &in asParentSocketName, bool abUseRotation, bool abSnapToParent = true)
Attaches the entity to another entity
void Entity_CallEntityInteract(const tString &in asName, const tString &in asBodyName = "", const cVector3f &in avFocusBodyOffset = cVector3f_Zero, const tString &in asData = "")
Calls OnInteract on the specified entity
void Entity_Connect(const tString &in asName, const tString &in asMainEntity, const tString &in asConnectEntity, bool abInvertStateSent, int alStatesUsed)
Creates a connection between two entities
iLuxEntity Entity_CreateAtEntity(const tString &in asNewEntityName, const tString &in asEntityFile, const tString &in asTargetEntityName, bool abFullGameSave)
Creates an entity at another entity
iLuxEntity Entity_CreateAtEntityExt(const tString &in asNewEntityName, const tString &in asEntityFile, const tString &in asTargetEntityName, bool abFullGameSave, const cVector3f &in avScale, const cVector3f &in avOffsetPosition, const cVector3f &in avOffsetRotation, bool abLocalOffset)
Creates an entity at another entity with extra options
void Entity_Destroy(const tString &in asName)
Destroys an entity of a given name
bool Entity_EntityIsInFront(const tString &in asTargetEntity, const tString &in asForwardEntity)
Returns true if the specified entity is in front of the other entity
bool Entity_Exists(const tString &in asName)
Check if an entity exists in the level
bool Entity_Exists(tID aID)
Check if an entity exists in the level
void Entity_FadeEffectBaseColor(const tString &in asEntityName, const cColor &in aColor, float afTime)
Fades the base color of the effects
void Entity_FadeProcAnimationSpeed(const tString &in asEntityName, const tString &in asAnimationName, float afSpeed, float afTime)
Fade the speed of a proc animation
bool Entity_GetAutoSleep(const tString &in asName)
Get if an entity automatically falls asleep when it isnt active
cVector3f Entity_GetBodyOffset(const tString &in asEntityName)
Returns the offset from centre specified in the
bool Entity_GetCollide(const tString &in asEntityA, const tString &in asEntityB)
Checks for collision between two specific entities
cVector3f Entity_GetDeltaToEntity(const tString &in asEntityA, const tString &in asEntityB)
Gets the direction and distance between two entities
cColor Entity_GetEffectBaseColor(const tString &in asEntityName)
Returns the base color of the effects
bool Entity_GetVarBool(const tString &in asEntityName, const tString &in asVarName)
Get value of an entity variable
cColor Entity_GetVarColor(const tString &in asEntityName, const tString &in asVarName)
Get value of an entity variable
float Entity_GetVarFloat(const tString &in asEntityName, const tString &in asVarName)
Get value of an entity variable
int Entity_GetVarInt(const tString &in asEntityName, const tString &in asVarName)
Get value of an entity variable
tString Entity_GetVarString(const tString &in asEntityName, const tString &in asVarName)
Get value of an entity variable
cVector2f Entity_GetVarVector2f(const tString &in asEntityName, const tString &in asVarName)
Get value of an entity variable
cVector3f Entity_GetVarVector3f(const tString &in asEntityName, const tString &in asVarName)
Get value of an entity variable
void Entity_IncVarFloat(const tString &in asEntityName, const tString &in asVarName, float afX)
Add a value to the current value of an entity variable
void Entity_IncVarInt(const tString &in asEntityName, const tString &in asVarName, int alX)
Add a value to the current value of an entity variable
void Entity_IncVarVector2f(const tString &in asEntityName, const tString &in asVarName, const cVector2f &in avX)
Add a value to the current value of an entity variable
void Entity_IncVarVector3f(const tString &in asEntityName, const tString &in asVarName, const cVector3f &in avX)
Add a value to the current value of an entity variable
bool Entity_IsActive(const tString &in asName)
Get if an entity is active (visible and functioning) or not
bool Entity_IsInPlayerFOV(const tString &in asEntity)
Returns true if the object is within the player's field of view
bool Entity_IsInteractedWith(const tString &in asName)
Checks if the entity is being interacted with
bool Entity_IsOccluder(const tString &in asName)
Get if an entity is an occluder
bool Entity_IsSleeping(const tString &in asName)
Check if an entity is asleep
void Entity_PlaceAtEntity(const tString &in asEntityName, const tString &in asTargetEntity, const cVector3f &in avOffset = cVector3f_Zero, bool abAlignRotation = false, bool abUseEntFileCenter = false)
Places the specified entity at another entity
void Entity_PlayAnimation(const tString &in asEntityName, const tString &in asAnimation, float afFadeTime = 0.1f, bool abLoop = false, bool abPlayTransition = true, const tString &in asCallback = "", bool abGlobal = false, bool abApplyBoneRootMotion = false)
Plays an animation on the entity
bool Entity_PlayerIsInFront(const tString &in asName)
Returns true if the player is in front of the specified entity
void Entity_PlayProcAnimation(const tString &in asEntityName, const tString &in asAnimation, float afLength, bool abLoop = false, float afAmountFadeTime = 0.1, float afSpeedFadeTime = -1.0f)
Plays a procedural animation on the entity
void Entity_Preload(const tString &in asEntityFile)
Preloads an entity
void Entity_RemoveAllConnections(const tString &in asMainEntity)
Removes all connections on an entity
bool Entity_RemoveCollideCallback(const tString &in asParentName, const tString &in asChildName)
Remove a callback for when entities (objects, areas etc) collide and/or collide with the player
void Entity_RemoveConnection(const tString &in asName, const tString &in asMainEntity)
Removes a specific connection on an entity
bool Entity_RemoveEntityAttachment(const tString &in asName)
Removes an attachment to another entity if the entity(ies) has one
void Entity_SetActive(const tString &in asName, bool abActive)
Set if entity is active (visible and functioning) or not
void Entity_SetAnimationMessageEventCallback(const tString &in asEntityName, const tString &in asCallbackFunc, bool abAutoRemove)
Sets a callback for the message events in the currently playing animation
void Entity_SetAnimationPaused(const tString &in asEntityName, const tString &in asAnimationName, bool abPaused = true)
Pause or unpause an animation on the specified entity
void Entity_SetAnimationRelativeTimePosition(const tString &in asEntityName, const tString &in asAnimationName, float afTimePos)
Sets the relative time position of a specific animation
void Entity_SetAutoSleep(const tString &in asName, bool abX)
Sets if the entity should sleep automatically when it need no updating
void Entity_SetCastShadows(const tString &in asEntityName, bool abCast)
Sets whether the entity casts shadows
void Entity_SetCollide(const tString &in asEntityName, bool abActive)
Turn off or on collision for all the bodies in the given entity
void Entity_SetCollideCharacter(const tString &in asEntityName, bool abActive)
Turn off or on character collision for all the bodies in the given entity
void Entity_SetColorMul(const tString &in asEntityName, const cColor &in aColor)
Set the color mul of the entity
void Entity_SetConnectionStateChangeCallback(const tString &in asEntityName, const tString &in asCallback)
Sets the callback for when the connection state changes on an entity
void Entity_SetEffectBaseColor(const tString &in asEntityName, const cColor &in aColor)
Sets the base color of the effects
void Entity_SetEffectsActive(const tString &in asEntityName, bool abActive, bool abFadeAndPlaySounds)
Activates or deactivates the effects on a entity
void Entity_SetEffectsActiveExt(const tString &in asEntityName, bool abActive, bool abFadeAndPlaySounds, float afEffectsOnTime, float afEffectsOffTime)
Activates or deactivates the effects on a entity
void Entity_SetInteractionDisabled(const tString &in asEntityName, bool abX)
Sets if the player can interact with an entity or not
void Entity_SetIsOccluder(const tString &in asName, bool abOccluder)
Set if entity is an occluder
void Entity_SetMaxInteractionDistance(const tString &in asEntityName, float afDistance)
Change the max interaction distance of an entity from the default/entity configured distance
void Entity_SetPlayerInteractCallback(const tString &in asEntityName, const tString &in asCallback, bool abRemoveWhenInteracted)
Sets the callback for when the player interacts with a specific entity
void Entity_SetPlayerLookAtCallback(const tString &in asEntityName, const tString &in asCallback, bool abRemoveWhenLookedAt = true, bool abCheckCenterOfScreen = true, bool abCheckRayIntersection = true, float afMaxDistance = -1, float afCallbackDelay = 0)
Sets the callback for when the player looks at or turns away from a specific entity
void Entity_SetProcAnimationPaused(const tString &in asEntityName, const tString &in asAnimationName, bool abPaused = true)
Pause or unpause a procedural animation on the specified entity
void Entity_SetProcAnimationSpeed(const tString &in asEntityName, const tString &in asAnimationName, float afSpeed)
Sets the speed of a proc animation
void Entity_SetReflectionVisibility(const tString &in asEntityName, bool abVisibleInReflection, bool abVisibleInWorld)
Sets whether the entity is drawn in reflections or not, and the real world or not
void Entity_SetVarBool(const tString &in asEntityName, const tString &in asVarName, bool abX)
Sets the value of an entity variable
void Entity_SetVarColor(const tString &in asEntityName, const tString &in asVarName, const cColor &in aX)
Sets the value of an entity variable
void Entity_SetVarFloat(const tString &in asEntityName, const tString &in asVarName, float afX)
Sets the value of an entity variable
void Entity_SetVarInt(const tString &in asEntityName, const tString &in asVarName, int alX)
Sets the value of an entity variable
void Entity_SetVarString(const tString &in asEntityName, const tString &in asVarName, const tString &in asX)
Sets the value of an entity variable
void Entity_SetVarVector2f(const tString &in asEntityName, const tString &in asVarName, const cVector2f &in avX)
Sets the value of an entity variable
void Entity_SetVarVector3f(const tString &in asEntityName, const tString &in asVarName, const cVector3f &in avX)
Sets the value of an entity variable
void Entity_Sleep(const tString &in asName)
Forces the entity to sleep (disabling Update/PostUpdate)
void Entity_StopAnimation(const tString &in asEntityName)
Stops any currently playing animation on the specified entity
void Entity_StopProcAnimation(const tString &in asEntityName, const tString &in asAnimation, float afFadeTime = 0.1f)
Stops a procedural animation on the specified entity
void Entity_StopSpecificAnimation(const tString &in asEntityName, const tString &in asAnimationName)
Stop a specific animation currently playing on the specified entity
void Entity_WakeUp(const tString &in asName)
Forces the entity to wake up (enabling Update/PostUpdate)

Function Detail

Entity_AddCollideCallback

bool Entity_AddCollideCallback(const tString &in asParentName,
                               const tString &in asChildName,
                               const tString &in asFunction)

Add a callback for when entities (objects, areas etc) collide and/or collides with the player.
Collision include when "uncolliding" as well.
Wildcard(s) * can be used in names to check for collisions.
@callback syntax for callback function, FunctionName(const tString &in asParent, const tString &in asChild, int alState).
@abbreviation syntax for the callback function code snippet, clbCollide.

Parameters

Returns:

  • bool—bool, false = callback is removed, true = callback can trigger again.

Entity_AddForce

void Entity_AddForce(const tString &in asEntityName,
                     const cVector3f &in avForce,
                     bool abLocalSpace,
                     bool abOnlyMainBody)

Adds force to the entity.

Parameters

  • asEntityName (tString) —
  • avForce (cVector3f) —
  • abLocalSpace (bool) —
  • abOnlyMainBody (bool) —

Returns:

  • void

Entity_AddForceFromEntity

void Entity_AddForceFromEntity(const tString &in asEntityName,
                               const tString &in asForceEntityName,
                               float afForce,
                               bool abOnlyMainBody)

Adds force to the entity away from another entity.

Parameters

  • asEntityName (tString) —
  • asForceEntityName (tString) —
  • afForce (float) —
  • abOnlyMainBody (bool) —

Returns:

  • void

Entity_AddImpulse

void Entity_AddImpulse(const tString &in asEntityName,
                       const cVector3f &in avImpulse,
                       bool abLocalSpace,
                       bool abOnlyMainBody)

Adds an impulse to the entity.

Parameters

  • asEntityName (tString) —
  • avImpulse (cVector3f) —
  • abLocalSpace (bool) —
  • abOnlyMainBody (bool) —

Returns:

  • void

Entity_AddImpulseFromEntity

void Entity_AddImpulseFromEntity(const tString &in asEntityName,
                                 const tString &in asImpulseEntityName,
                                 float afImpulse,
                                 bool abOnlyMainBody)

Adds an impulse to the entity away from another entity.

Parameters

  • asEntityName (tString) —
  • asImpulseEntityName (tString) —
  • afImpulse (float) —
  • abOnlyMainBody (bool) —

Returns:

  • void

Entity_AddTorque

void Entity_AddTorque(const tString &in asEntityName,
                      const cVector3f &in avTorque,
                      bool abLocalSpace,
                      bool abOnlyMainBody)

Adds torque to an entity to provide some angular velocity

Parameters

  • asEntityName (tString) —
  • avTorque (cVector3f) —
  • abLocalSpace (bool) —
  • abOnlyMainBody (bool) —

Returns:

  • void

Entity_AttachToEntity

bool Entity_AttachToEntity(const tString &in asName,
                           const tString &in asParentName,
                           const tString &in asParentBodyName,
                           bool abUseRotation,
                           bool abSnapToParent = false,
                           bool abLocked = false)

Attaches the entity to another entity. If already attached, it will be removed before attaching to new

Parameters

  • asName (tString) —
  • asParentName (tString) —
  • asParentBodyName (tString) —
  • abUseRotation (bool) —
  • abSnapToParent (bool) —
  • abLocked (bool) —

Returns:

  • bool

Entity_AttachToSocket

bool Entity_AttachToSocket(const tString &in asName,
                           const tString &in asParentName,
                           const tString &in asParentSocketName,
                           bool abUseRotation,
                           bool abSnapToParent = true)

Attaches the entity to another entity. If already attached, it will be removed before attaching to new

Parameters

  • asName (tString) —
  • asParentName (tString) —
  • asParentSocketName (tString) —
  • abUseRotation (bool) —
  • abSnapToParent (bool) —

Returns:

  • bool

Entity_CallEntityInteract

void Entity_CallEntityInteract(const tString &in asName,
                               const tString &in asBodyName = "",
                               const cVector3f &in avFocusBodyOffset = cVector3f_Zero,
                               const tString &in asData = "")

Calls OnInteract on the specified entity.

Parameters

Returns:

  • voidbool, true if the position is in front of the entity.

Entity_Connect

void Entity_Connect(const tString &in asName,
                    const tString &in asMainEntity,
                    const tString &in asConnectEntity,
                    bool abInvertStateSent,
                    int alStatesUsed)

Creates a connection between two entities.

Parameters

  • asName (tString) —
  • asMainEntity (tString) —
  • asConnectEntity (tString) —
  • abInvertStateSent (bool) —
  • alStatesUsed (int) —

Returns:

  • void

Entity_CreateAtEntity

iLuxEntity@ Entity_CreateAtEntity(const tString &in asNewEntityName,
                                  const tString &in asEntityFile,
                                  const tString &in asTargetEntityName,
                                  bool abFullGameSave)

Creates an entity at another entity.

Parameters

  • asNewEntityName (tString) —
  • asEntityFile (tString) —
  • asTargetEntityName (tString) —
  • abFullGameSave (bool) —

Returns:

  • iLuxEntity@

Entity_CreateAtEntityExt

iLuxEntity@ Entity_CreateAtEntityExt(const tString &in asNewEntityName,
                                     const tString &in asEntityFile,
                                     const tString &in asTargetEntityName,
                                     bool abFullGameSave,
                                     const cVector3f &in avScale,
                                     const cVector3f &in avOffsetPosition,
                                     const cVector3f &in avOffsetRotation,
                                     bool abLocalOffset)

Creates an entity at another entity with extra options.

Parameters

Returns:

  • iLuxEntity@

Entity_Destroy

void Entity_Destroy(const tString &in asName)

Destroys an entity of a given name.

Parameters

Returns:

  • void

Entity_EntityIsInFront

bool Entity_EntityIsInFront(const tString &in asTargetEntity,
                            const tString &in asForwardEntity)

Returns true if the specified entity is in front of the other entity.
The function assumes the entity's z-axis points forward. Anything less than 90
degrees offset from the forward vector counts as "in front".

Parameters

Returns:

  • bool—bool, true if the target entity is in front.

Entity_Exists

bool Entity_Exists(const tString &in asName)

Check if an entity exists in the level.

Parameters

Returns:

  • bool—bool, if entity exists.

Entity_Exists

bool Entity_Exists(tID aID)

Check if an entity exists in the level.

Parameters

Returns:

  • bool—bool, if entity exists.

Entity_FadeEffectBaseColor

void Entity_FadeEffectBaseColor(const tString &in asEntityName,
                                const cColor &in aColor,
                                float afTime)

Fades the base color of the effects

Parameters

  • asEntityName (tString) —
  • aColor (cColor) —
  • afTime (float) —

Returns:

  • void

Entity_FadeProcAnimationSpeed

void Entity_FadeProcAnimationSpeed(const tString &in asEntityName,
                                   const tString &in asAnimationName,
                                   float afSpeed,
                                   float afTime)

Fade the speed of a proc animation.

Parameters

  • asEntityName (tString) —
  • asAnimationName (tString) —
  • afSpeed (float) —
  • afTime (float) —

Returns:

  • void

Entity_GetAutoSleep

bool Entity_GetAutoSleep(const tString &in asName)

Get if an entity automatically falls asleep when it isnt active

Parameters

Returns:

  • bool—bool, if sleeping or not.

Entity_GetBodyOffset

cVector3f Entity_GetBodyOffset(const tString &in asEntityName)

Returns the offset from centre specified in the .ent file. Only works for props.

Parameters

Returns:

  • cVector3f—cVector3f, the offset

Entity_GetCollide

bool Entity_GetCollide(const tString &in asEntityA,
                       const tString &in asEntityB)

Checks for collision between two specific entities. Wildcard(s) * are NOT supported!

Parameters

Returns:

  • bool

Entity_GetDeltaToEntity

cVector3f Entity_GetDeltaToEntity(const tString &in asEntityA,
                                  const tString &in asEntityB)

Gets the direction and distance between two entities

Parameters

Returns:

  • cVector3f—cVector3f, delta between the entities, delta = direction * distance = entity_b_pos - entity_a_pos

Entity_GetEffectBaseColor

cColor Entity_GetEffectBaseColor(const tString &in asEntityName)

Returns the base color of the effects

Parameters

Returns:

  • cColor

Entity_GetVarBool

bool Entity_GetVarBool(const tString &in asEntityName,
                       const tString &in asVarName)

Get value of an entity variable.

Parameters

Returns:

  • bool

Entity_GetVarColor

cColor Entity_GetVarColor(const tString &in asEntityName,
                          const tString &in asVarName)

Get value of an entity variable.

Parameters

Returns:

  • cColor

Entity_GetVarFloat

float Entity_GetVarFloat(const tString &in asEntityName,
                         const tString &in asVarName)

Get value of an entity variable.

Parameters

Returns:

  • float

Entity_GetVarInt

int Entity_GetVarInt(const tString &in asEntityName,
                     const tString &in asVarName)

Get value of an entity variable.

Parameters

Returns:

  • int

Entity_GetVarString

tString Entity_GetVarString(const tString &in asEntityName,
                            const tString &in asVarName)

Get value of an entity variable.

Parameters

Returns:

  • tString

Entity_GetVarVector2f

cVector2f Entity_GetVarVector2f(const tString &in asEntityName,
                                const tString &in asVarName)

Get value of an entity variable.

Parameters

Returns:

  • cVector2f

Entity_GetVarVector3f

cVector3f Entity_GetVarVector3f(const tString &in asEntityName,
                                const tString &in asVarName)

Get value of an entity variable.

Parameters

Returns:

  • cVector3f

Entity_IncVarFloat

void Entity_IncVarFloat(const tString &in asEntityName,
                        const tString &in asVarName,
                        float afX)

Add a value to the current value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_IncVarInt

void Entity_IncVarInt(const tString &in asEntityName,
                      const tString &in asVarName,
                      int alX)

Add a value to the current value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_IncVarVector2f

void Entity_IncVarVector2f(const tString &in asEntityName,
                           const tString &in asVarName,
                           const cVector2f &in avX)

Add a value to the current value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_IncVarVector3f

void Entity_IncVarVector3f(const tString &in asEntityName,
                           const tString &in asVarName,
                           const cVector3f &in avX)

Add a value to the current value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_IsActive

bool Entity_IsActive(const tString &in asName)

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

Parameters

Returns:

  • bool—bool, if active or not.

Entity_IsInPlayerFOV

bool Entity_IsInPlayerFOV(const tString &in asEntity)

Returns true if the object is within the player's field of view. This does not take into account line of sight.

Parameters

Returns:

  • bool—bool, true if the entity is in the player's field of view.

Entity_IsInteractedWith

bool Entity_IsInteractedWith(const tString &in asName)

Checks if the entity is being interacted with.

Parameters

Returns:

  • bool—bool, if the entity is being interacted with

Entity_IsOccluder

bool Entity_IsOccluder(const tString &in asName)

Get if an entity is an occluder

Parameters

Returns:

  • bool—bool, if occluder

Entity_IsSleeping

bool Entity_IsSleeping(const tString &in asName)

Check if an entity is asleep

Parameters

Returns:

  • bool—bool, if sleeping or not.

Entity_PlaceAtEntity

void Entity_PlaceAtEntity(const tString &in asEntityName,
                          const tString &in asTargetEntity,
                          const cVector3f &in avOffset = cVector3f_Zero,
                          bool abAlignRotation = false,
                          bool abUseEntFileCenter = false)

Places the specified entity at another entity. Optionally aligning its rotation with the target entity.

Parameters

  • asEntityName (tString) —
  • asTargetEntity (tString) —
  • avOffset (cVector3f) —
  • abAlignRotation (bool) —
  • abUseEntFileCenter (bool) —

Returns:

  • void

Entity_PlayAnimation

void Entity_PlayAnimation(const tString &in asEntityName,
                          const tString &in asAnimation,
                          float afFadeTime = 0.1f,
                          bool abLoop = false,
                          bool abPlayTransition = true,
                          const tString &in asCallback = "",
                          bool abGlobal = false,
                          bool abApplyBoneRootMotion = false)

Plays an animation on the entity
@callback syntax, MyFunc(string &in asProp)

Parameters

  • asEntityName (tString) —
  • asAnimation (tString) —
  • afFadeTime (float) —
  • abLoop (bool) —
  • abPlayTransition (bool) —
  • asCallback (tString) — (optional), name of callback function. Syntax void Func(const tString &in asEntityName, const tString &in asAnimName)
  • abGlobal (bool) — (optional), if animation is played in global space
  • abApplyBoneRootMotion (bool) —

Returns:

  • void

Entity_PlayerIsInFront

bool Entity_PlayerIsInFront(const tString &in asName)

Returns true if the player is in front of the specified entity.
The function assumes the entity's z-axis points forward. Anything less than 90
degrees offset from the forward vector counts as "in front".

Parameters

Returns:

  • bool—bool, true if the target entity is in front.

Entity_PlayProcAnimation

void Entity_PlayProcAnimation(const tString &in asEntityName,
                              const tString &in asAnimation,
                              float afLength,
                              bool abLoop = false,
                              float afAmountFadeTime = 0.1,
                              float afSpeedFadeTime = -1.0f)

Plays a procedural animation on the entity

Parameters

  • asEntityName (tString) —
  • asAnimation (tString) —
  • afLength (float) —
  • abLoop (bool) —
  • afAmountFadeTime (float) —
  • afSpeedFadeTime (float) —

Returns:

  • void

Entity_Preload

void Entity_Preload(const tString &in asEntityFile)

Preloads an entity

Parameters

Returns:

  • void

Entity_RemoveAllConnections

void Entity_RemoveAllConnections(const tString &in asMainEntity)

Removes all connections on an entity.

Parameters

Returns:

  • void

Entity_RemoveCollideCallback

bool Entity_RemoveCollideCallback(const tString &in asParentName,
                                  const tString &in asChildName)

Remove a callback for when entities (objects, areas etc) collide and/or collide with the player.
Wildcard(s) * can be used in names.

Parameters

Returns:

  • bool

Entity_RemoveConnection

void Entity_RemoveConnection(const tString &in asName,
                             const tString &in asMainEntity)

Removes a specific connection on an entity.

Parameters

Returns:

  • void

Entity_RemoveEntityAttachment

bool Entity_RemoveEntityAttachment(const tString &in asName)

Removes an attachment to another entity if the entity(ies) has one.

Parameters

Returns:

  • bool

Entity_SetActive

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

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

Parameters

  • asName (tString) —
  • abActive (bool) —

Returns:

  • void

Entity_SetAnimationMessageEventCallback

void Entity_SetAnimationMessageEventCallback(const tString &in asEntityName,
                                             const tString &in asCallbackFunc,
                                             bool abAutoRemove)

Sets a callback for the message events in the currently playing animation.

Parameters

  • asEntityName (tString) —
  • asCallbackFunc (tString) —
  • abAutoRemove (bool) —

Returns:

  • void

Entity_SetAnimationPaused

void Entity_SetAnimationPaused(const tString &in asEntityName,
                               const tString &in asAnimationName,
                               bool abPaused = true)

Pause or unpause an animation on the specified entity.

Parameters

  • asEntityName (tString) —
  • asAnimationName (tString) —
  • abPaused (bool) —

Returns:

  • void

Entity_SetAnimationRelativeTimePosition

void Entity_SetAnimationRelativeTimePosition(const tString &in asEntityName,
                                             const tString &in asAnimationName,
                                             float afTimePos)

Sets the relative time position of a specific animation.

Parameters

  • asEntityName (tString) —
  • asAnimationName (tString) —
  • afTimePos (float) —

Returns:

  • void

Entity_SetAutoSleep

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

Sets if the entity should sleep automatically when it need no updating

Parameters

  • asName (tString) —
  • abX (bool) —

Returns:

  • void

Entity_SetCastShadows

void Entity_SetCastShadows(const tString &in asEntityName,
                           bool abCast)

Sets whether the entity casts shadows.

Parameters

  • asEntityName (tString) —
  • abCast (bool) —

Returns:

  • void

Entity_SetCollide

void Entity_SetCollide(const tString &in asEntityName,
                       bool abActive)

Turn off or on collision for all the bodies in the given entity.

Parameters

  • asEntityName (tString) —
  • abActive (bool) —

Returns:

  • void

Entity_SetCollideCharacter

void Entity_SetCollideCharacter(const tString &in asEntityName,
                                bool abActive)

Turn off or on character collision for all the bodies in the given entity.

Parameters

  • asEntityName (tString) —
  • abActive (bool) —

Returns:

  • void

Entity_SetColorMul

void Entity_SetColorMul(const tString &in asEntityName,
                        const cColor &in aColor)

Set the color mul of the entity

Parameters

Returns:

  • void

Entity_SetConnectionStateChangeCallback

void Entity_SetConnectionStateChangeCallback(const tString &in asEntityName,
                                             const tString &in asCallback)

Sets the callback for when the connection state changes on an entity
@callback callback syntax, FunctionName(string &in asEntityName, int alState).

Parameters

Returns:

  • void

Entity_SetEffectBaseColor

void Entity_SetEffectBaseColor(const tString &in asEntityName,
                               const cColor &in aColor)

Sets the base color of the effects

Parameters

Returns:

  • void

Entity_SetEffectsActive

void Entity_SetEffectsActive(const tString &in asEntityName,
                             bool abActive,
                             bool abFadeAndPlaySounds)

Activates or deactivates the effects on a entity.

Parameters

  • asEntityName (tString) —
  • abActive (bool) —
  • abFadeAndPlaySounds (bool) —

Returns:

  • void

Entity_SetEffectsActiveExt

void Entity_SetEffectsActiveExt(const tString &in asEntityName,
                                bool abActive,
                                bool abFadeAndPlaySounds,
                                float afEffectsOnTime,
                                float afEffectsOffTime)

Activates or deactivates the effects on a entity.

Parameters

  • asEntityName (tString) —
  • abActive (bool) —
  • abFadeAndPlaySounds (bool) —
  • afEffectsOnTime (float) —
  • afEffectsOffTime (float) —

Returns:

  • void

Entity_SetInteractionDisabled

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

Sets if the player can interact with an entity or not.

Parameters

  • asEntityName (tString) —
  • abX (bool) —

Returns:

  • void

Entity_SetIsOccluder

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

Set if entity is an occluder

Parameters

  • asName (tString) —
  • abOccluder (bool) —

Returns:

  • void

Entity_SetMaxInteractionDistance

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

Change the max interaction distance of an entity from the default/entity configured distance.

Parameters

  • asEntityName (tString) —
  • afDistance (float) —

Returns:

  • void

Entity_SetPlayerInteractCallback

void Entity_SetPlayerInteractCallback(const tString &in asEntityName,
                                      const tString &in asCallback,
                                      bool abRemoveWhenInteracted)

Sets the callback for when the player interacts with a specific entity.
@callback callback syntax, FunctionName(string &in asEntityName).

Parameters

  • asEntityName (tString) —
  • asCallback (tString) —
  • abRemoveWhenInteracted (bool) —

Returns:

  • void

Entity_SetPlayerLookAtCallback

void Entity_SetPlayerLookAtCallback(const tString &in asEntityName,
                                    const tString &in asCallback,
                                    bool abRemoveWhenLookedAt = true,
                                    bool abCheckCenterOfScreen = true,
                                    bool abCheckRayIntersection = true,
                                    float afMaxDistance = -1,
                                    float afCallbackDelay = 0)

Sets the callback for when the player looks at or turns away from a specific entity.
@callback callback syntax, void FunctionName(const tString &in asEntityName, int alState). alState is 1 if the player looks at the entity and -1 if the player stops looking.

Parameters

  • asEntityName (tString) —
  • asCallback (tString) —
  • abRemoveWhenLookedAt (bool) —
  • abCheckCenterOfScreen (bool) —
  • abCheckRayIntersection (bool) —
  • afMaxDistance (float) —
  • afCallbackDelay (float) —

Returns:

  • void

Entity_SetProcAnimationPaused

void Entity_SetProcAnimationPaused(const tString &in asEntityName,
                                   const tString &in asAnimationName,
                                   bool abPaused = true)

Pause or unpause a procedural animation on the specified entity.

Parameters

  • asEntityName (tString) —
  • asAnimationName (tString) —
  • abPaused (bool) —

Returns:

  • void

Entity_SetProcAnimationSpeed

void Entity_SetProcAnimationSpeed(const tString &in asEntityName,
                                  const tString &in asAnimationName,
                                  float afSpeed)

Sets the speed of a proc animation.

Parameters

  • asEntityName (tString) —
  • asAnimationName (tString) —
  • afSpeed (float) —

Returns:

  • void

Entity_SetReflectionVisibility

void Entity_SetReflectionVisibility(const tString &in asEntityName,
                                    bool abVisibleInReflection,
                                    bool abVisibleInWorld)

Sets whether the entity is drawn in reflections or not, and the real world or not.

Parameters

  • asEntityName (tString) —
  • abVisibleInReflection (bool) —
  • abVisibleInWorld (bool) —

Returns:

  • void

Entity_SetVarBool

void Entity_SetVarBool(const tString &in asEntityName,
                       const tString &in asVarName,
                       bool abX)

Sets the value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_SetVarColor

void Entity_SetVarColor(const tString &in asEntityName,
                        const tString &in asVarName,
                        const cColor &in aX)

Sets the value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_SetVarFloat

void Entity_SetVarFloat(const tString &in asEntityName,
                        const tString &in asVarName,
                        float afX)

Sets the value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_SetVarInt

void Entity_SetVarInt(const tString &in asEntityName,
                      const tString &in asVarName,
                      int alX)

Sets the value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_SetVarString

void Entity_SetVarString(const tString &in asEntityName,
                         const tString &in asVarName,
                         const tString &in asX)

Sets the value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_SetVarVector2f

void Entity_SetVarVector2f(const tString &in asEntityName,
                           const tString &in asVarName,
                           const cVector2f &in avX)

Sets the value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_SetVarVector3f

void Entity_SetVarVector3f(const tString &in asEntityName,
                           const tString &in asVarName,
                           const cVector3f &in avX)

Sets the value of an entity variable. Wildcard(s) * are supported for EntityName.

Parameters

Returns:

  • void

Entity_Sleep

void Entity_Sleep(const tString &in asName)

Forces the entity to sleep (disabling Update/PostUpdate). Has no effect if it is already sleeping

Parameters

Returns:

  • void

Entity_StopAnimation

void Entity_StopAnimation(const tString &in asEntityName)

Stops any currently playing animation on the specified entity.

Parameters

Returns:

  • void

Entity_StopProcAnimation

void Entity_StopProcAnimation(const tString &in asEntityName,
                              const tString &in asAnimation,
                              float afFadeTime = 0.1f)

Stops a procedural animation on the specified entity.

Parameters

  • asEntityName (tString) —
  • asAnimation (tString) —
  • afFadeTime (float) —

Returns:

  • void

Entity_StopSpecificAnimation

void Entity_StopSpecificAnimation(const tString &in asEntityName,
                                  const tString &in asAnimationName)

Stop a specific animation currently playing on the specified entity.

Parameters

Returns:

  • void

Entity_WakeUp

void Entity_WakeUp(const tString &in asName)

Forces the entity to wake up (enabling Update/PostUpdate). Has no effect if it is already awake

Parameters

Returns:

  • void