Skip to content
HELIX is in Early Access Preview. Some features and documentation may be non-functional or out of date.

HPlayer

HPlayer is a high-level wrapper for the local or remote player controller It extends the core functionality of Controller class, providing utility methods and accessors commonly used in gameplay scripting Unlike actors or components, HPlayer is not spawned manually, instead it represents an already-existing controller instance, typically associated with a connected player Each connected player (local or remote) can be accessed and controlled through this class, and a global Players table keeps track of all active instances

Tip

HPlayer is a Controller so it inherits all functions from Controller

Functions#

GetControlledCharacter#

Retrieves the character currently controlled by this player

  • returns: APawn
Example
local character = HPlayer:GetControlledCharacter()

GetCameraLocation#

Returns the camera's world location

  • returns: Vector
Example
local cameraLocation = HPlayer:GetCameraLocation()

GetCameraRotation#

Returns the camera's world rotation

  • returns: FRotator
Example
local cameraRotation = HPlayer:GetCameraRotation()

GetCameraArmLength#

Returns the spring arm length, if any

  • returns: number | nil
Example
local cameraArmLength = HPlayer:GetCameraArmLength()

StartCameraFade#

Starts a fade effect on the camera

  • FromAlpha number
  • ToAlpha number
  • Duration number
  • Color LinearColor
  • bShouldFadeAudio boolean
  • bHoldWhenFinished boolean
Example
HPlayer:StartCameraFade()

SetManualCameraFade#

Applies a constant fade at a given opacity

  • InFadeAmount number
  • Color LinearColor
  • bInFadeAudio boolean
Example
HPlayer:SetManualCameraFade()

StopCameraFade#

Stops any active fade effect on the camera

Example
HPlayer:StopCameraFade()

SetCameraLocation#

Moves the spring arm to a new location

  • NewLocation Vector
  • bSweep boolean
  • bTeleport boolean
Example
HPlayer:SetCameraLocation()

SetCameraRotation#

Rotates the spring arm in world space

  • NewRotation Rotator
  • bSweep boolean
  • bTeleport boolean
Example
HPlayer:SetCameraRotation()

TranslateCameraTo#

Interpolates the camera's location

  • Target Vector
  • DeltaTime number
  • InterpSpeed number
Example
HPlayer:TranslateCameraTo()

SetCameraSocketOffset#

Sets the camera's socket offset (end of spring arm)

  • Offset Vector
Example
HPlayer:SetCameraSocketOffset()

SetCameraArmLength#

Sets the arm length for the spring arm

  • Length number
  • bSkipLerp boolean
Example
HPlayer:SetCameraArmLength()

AttachCameraTo#

Attaches the camera to another scene component

  • InParent USceneComponent
  • SocketOffset Vector
  • BlendSpeed number
  • returns: boolean
Example
local wasAttached = HPlayer:AttachCameraTo()

ResetCamera#

Resets the camera to its default state

Example
HPlayer:ResetCamera()

RotateCameraTo#

Smoothly rotates the player’s view

  • Rotation Rotator
  • Time number
  • BlendSpeed number
Example
HPlayer:RotateCameraTo()

SetValue#

Stores a custom value

  • key any
  • value any
  • returns: boolean
Example
local value = HPlayer:SetValue()

GetValue#

Retrieves a stored custom value

  • key any
  • returns: any
Example
local value = HPlayer:GetValue()

GetName#

Returns the player's name

  • returns: string
Example
local name = HPlayer:GetName()

GetPing#

Returns the player’s ping

  • returns: number
Example
local ping = HPlayer:GetPing()

IsLocalPlayer#

Checks if this is the local player

  • returns: boolean
Example
local isLocal = HPlayer:IsLocalPlayer()

GiveItemByKey#

Grants an item to the player

  • key string: Registered item key
  • returns: ULyraInventoryItemInstance | nil
Example
local giveItem = HPlayer:GiveItemByKey()

RemoveItemByKey#

Removes an item by key

  • key string: Registered item key
  • returns: boolean
Example
local removeItem = HPlayer:RemoveItemByKey()

ClearInventory#

Clears the player’s inventory

Example
HPlayer:ClearInventory()

GetAll#

Returns all active players

  • returns: table
Example
local players = HPlayer:GetAll()

GetByIndex#

Gets a player by controller reference

  • Controller APlayerController
  • returns: HPlayer
Example
local player = HPlayer:GetByIndex()

GetCount#

Returns the number of tracked players

  • returns: number
Example
local playerCount = HPlayer:GetCount()

JoinVoiceChannel#

Joins particular voice channel id. Only callable by the server/host.

  • InChannelId number
Example
HPlayer:JoinVoiceChannel()

LeaveVoiceChannel#

Leaves particular voice channel id. Only callable by the server/host.

  • InChannelId number
Example
HPlayer:LeaveVoiceChannel()

IsInVoiceChannel#

Checks if player is present in a provided voice channel. Only callable by the server/host.

  • InChannelId number
  • returns: boolean
Example
local isInVoiceChannel = HPlayer:IsInVoiceChannel()

MuteInVoiceChannel#

Mutes this player in a particular voice channel. The player can't talk, but is still able to hear others. Only callable by the server/host.

  • InChannelId number
Example
HPlayer:MuteInVoiceChannel()

UnmuteInVoiceChannel#

Unmutes this player in a particular voice channel. Only callable by the server/host.

  • InChannelId number
Example
HPlayer:UnmuteInVoiceChannel()

IsMutedInVoiceChannel#

Checks if player is muted inside a particular voice channel. Only callable by the server/host.

  • InChannelId number
  • returns: boolean
Example
local isMuted = HPlayer:IsMutedInVoiceChannel()

MuteForOtherPlayer#

Mutes this player for another player. The other player won't be able to hear this player. Only callable by the server/host.

  • InOtherPlayer APlayerState
Example
HPlayer:MuteForOtherPlayer()

UnmuteForOtherPlayer#

Unmutes this player for another player. Only callable by the server/host.

  • InOtherPlayer APlayerState
Example
HPlayer:UnmuteForOtherPlayer()

IsMutedForOtherPlayer#

Checks if player is muted for another player. Only callable by the server/host.

  • InOtherPlayer APlayerState
  • returns: boolean
Example
local isMuted = HPlayer:IsMutedForOtherPlayer()

GetVoiceChannels#

Returns all voice channel ids that the player belongs to. Only callable by the server/host.

  • returns: table
Example
local channelIds = HPlayer:GetVoiceChannels()

IsTalking#

Checks if the player is currently talking. Only callable by the local player.

  • returns: boolean
Example
local isTalking = HPlayer:IsTalking()

GetVoiceAmplitude#

Returns current amplitude of the voice during talking. Only callable by the local player.

  • returns: number
Example
local amplitude = HPlayer:GetVoiceAmplitude()

SetMicNoiseGateThreshold#

Sets threshold at which the voice noise gate cuts off the voice. Only callable by the local player.

  • InThreshold number
Example
HPlayer:SetMicNoiseGateThreshold()

SetMicSilenceDetectionThreshold#

Sets threshold at which the voice system interprets our voice as "silence". When the silence is detected, no information about the audio will be sent. Only callable by the local player.

  • InThreshold number
Example
HPlayer:SetMicSilenceDetectionThreshold()

GetMicNoiseGateThreshold#

Returns threshold at which the voice noise gate cuts off the voice. Only callable by the local player.

  • returns: number
Example
local threshold = HPlayer:GetMicNoiseGateThreshold()

GetMicSilenceDetectionThreshold#

Returns threshold at which the voice system interprets our voice as "silence". When the silence is detected. Only callable by the local player.

  • returns: number
Example
local threshold = HPlayer:GetMicSilenceDetectionThreshold()