HPL3/Areas/Trigger Area

From Frictional Wiki
< HPL3
Revision as of 21:57, 25 January 2024 by Lil alex (talk | contribs) (Rewrote article to be more concise and added missing information)
Jump to navigation Jump to search

Overview

The Trigger area runs a callback function when an entity collides or otherwise interacts with it.

Properties

Base

  • BlockLineOfSight: Blocks line of sight.
  • EventInstanceTag: A tag used by the event system to group objects.
  • UserVar: Arbitrary user variable. Acessable by calling the script function Entity_GetVar<type>()

Collide Callbacks

  • CC_Entities: A list separated by commas or spaces of all entities that can trigger the callback. player is the player character.
  • CC_Funcs: A list of functions that will run when the area is triggered. Press copy to generate a callback function and copy to the clipboard

Attachment

  • ParentAttachEntity: The name of an entity that this soundscape is parented to.
  • ParentAttachUseRotation: If the rotation of the parent should affect the soundscape.
  • ParentAttachBody: The name of the body in the parent entity to attach to.
  • ParentAttachLocked: Locks the area to the parent and disables local movement.

Basic Callbacks

  • PlayerLookAtCallback: A function that will run when looking at the entity. Press generate to generate a name for this text field.
  • PlayerLookAtCallbackAutoRemove: Removes the callback after it fires once.
  • PlayerLookAtCheckCenterOfScreen: Only counts as looked if the entity is in the center of the screen.
  • PlayerLookAtCheckRayInIntersection: Only counts as looked at if their is a clear line of sight, i.e. not through a transparent object. Can return false negatives, especially if PlayerLookAtCheckCenterOfScreen is disabled.
  • PlayerLookAtMaxDistance: Max distance an entity can be from the area. Values lower than 0 default to max distance.
  • PlayerLookAtCallbackDelay: Time in seconds to delay the callback
  • PlayerInteractCallback: Callback when the player interacts with the entity, i.e. grabbing or using. Press generate to generate a name for this text field.
  • PlayerInteractCallbackAutoRemove: Removes the callback after it fires once.

Interaction

Settings used when the player interacts with the entity by clicking on it.

  • CanInteractWithoutCallback: Allows the area to be interacted with despite having an empty callback.
  • MaxFocusDistance: Maximum distance a player can be to interact. Values lower than 0 are set to the default.
  • CustomInteraction: The icon shown when interaction is possible.

Callback function syntax

This is the basic syntax for a collision callback function.

bool FunctionName(const tString &in asParent, const tString &in asChild, int alState)
{
    if(alState == 1) // 1 = entering area, -1 = leaving area
    {
        // Insert code here
    }
    return false;
}