Skip to main content

HCharacter

Characters represents Actors which can be possessed, can move and interact with world. They are the default Skeletal Mesh Character built for HELIX.

💂Authority
This class can only be spawned on 🟦 Server side.
👪Inheritance
This class shares methods and events from Base Entity, Base Actor, Base Paintable, Damageable.

HCharacters are Skeletal Meshes using Unreal's Metahuman Skeleton, with animations and interactivity already natively integrated into HELIX. It is possible to import any Skeletal Mesh (which uses Unreal's Metahuman Skeleton to this HCharacter.

Examples​

Server/Index.lua
-------------------------------------------------------------------------------------
-- The following example spawns a HCharacter with the Helix Customizable character --
-- when players join the server and destroys them when they leave. --
-------------------------------------------------------------------------------------

-- Function to spawn a Character to a player
function SpawnCharacter(player)
Console.Log("Spawn player")
local new_character = HCharacter(Vector(0, 0, 0), Rotator(0, 0, 0), player)
-- Possess the new Character
player:Possess(new_character)
end

-- Subscribes to an Event which is triggered when Players join the server (i.e. Spawn)
Player.Subscribe("Spawn", SpawnCharacter)

-- Iterates for all already connected players and give them a Character as well
-- This will make sure you also get a Character when you reload the package
Package.Subscribe("Load", function()
for k, player in pairs(Player.GetAll()) do
SpawnCharacter(player)
end
end)

-- When Player leaves the server, destroy it's Character
Player.Subscribe("Destroy", function(player)
local character = player:GetControlledCharacter()
if (character) then
character:Destroy()
end
end)


Constructors​

Default Constructor (Helix Avatar)​

local my_hcharacter = HCharacter(location, rotation, player, collision_type?, gravity_enabled?, max_health?, death_sound?, pain_sound?)
TypeNameDefaultDescription
Vectorlocation
Rotatorrotation
Playerplayer
CollisionTypecollision_typeCollisionType.Normal
booleangravity_enabledtrue
integermax_health100Current / Max Health
Sound Referencedeath_soundhelix::A_Male_01_DeathPlayed when Character dies
Sound Referencepain_soundhelix::A_Male_01_PainPlayed when Character takes damage

Custom Mesh Constructor​

local my_hcharacter = HCharacter(location, rotation, skeletal_mesh, collision_type?, gravity_enabled?, max_health?, death_sound?, pain_sound?)
TypeNameDefaultDescription
Vectorlocation
Rotatorrotation
SkeletalMesh Referenceskeletal_mesh
CollisionTypecollision_typeCollisionType.Normal
booleangravity_enabledtrue
integermax_health100Current / Max Health
Sound Referencedeath_soundhelix::A_Male_01_DeathPlayed when Character dies
Sound Referencepain_soundhelix::A_Male_01_PainPlayed when Character takes damage

Static Functions​

Inherited Entity Static Functions
Base Entityscripting-reference/classes/base-classes/Entity
ReturnsNameDescription
table of Base EntityGetAllReturns a table containing all Entities of the class this is called on
Base EntityGetByIndexReturns a specific Entity of this class at an index
integerGetCountReturns how many Entities of this class exist
iteratorGetPairsReturns an iterator with all Entities of this class to be used with pairs()
tableInheritInherits this class with the Inheriting System
table of tableGetInheritedClassesGets a list of all directly inherited classes from this Class created with the Inheriting System
table or nilGetParentClassGets the parent class if this Class was created with the Inheriting System
booleanIsChildOfGets if this Class is child of another class if this Class was created with the Inheriting System
functionSubscribeSubscribes to an Event for all entities of this Class
functionSubscribeRemoteSubscribes to a custom event called from server
UnsubscribeUnsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed
This entity doesn't have own static functions.

Functions​

Inherited Entity Functions
Base Entityscripting-reference/classes/base-classes/Entity
ReturnsNameDescription
integerGetIDGets the universal network ID of this Entity (same on both client and server)
tableGetClassGets the class of this entity
booleanIsARecursively checks if this entity is inherited from a Class
functionSubscribeSubscribes to an Event on this specific entity
functionSubscribeRemoteSubscribes to a custom event called from server on this specific entity
UnsubscribeUnsubscribes all callbacks from this Event in this Entity within this Package, or only the callback passed
SetValueSets a Value in this Entity
anyGetValueGets a Value stored on this Entity at the given key
DestroyDestroys this Entity
booleanIsValidReturns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity)
CallRemoteEventCalls a custom remote event directly on this entity to a specific Player
CallRemoteEventCalls a custom remote event directly on this entity
BroadcastRemoteEventCalls a custom remote event directly on this entity to all Players
Inherited Actor Functions
Base Actorscripting-reference/classes/base-classes/Actor
ReturnsNameDescription
AddImpulseApplies a force in world world to this Actor
AttachToAttaches this Actor to any other Actor, optionally at a specific bone
DetachDetaches this Actor from AttachedTo Actor
SetCollisionSets this Actor's collision type
SetDimensionSets this Actor's Dimension
SetForceAdds a permanent force to this Actor, set to Vector(0, 0, 0) to cancel
SetGravityEnabledSets whether gravity is enabled on this Actor
SetVisibilitySets whether the actor is visible or not
SetHighlightEnabledSets whether the highlight is enabled on this Actor, and which highlight index to use
SetOutlineEnabledSets whether the outline is enabled on this Actor, and which outline index to use
SetLifeSpanSets the time (in seconds) before this Actor is destroyed. After this time has passed, the actor will be automatically destroyed.
SetLocationSets this Actor's location in the game world
SetRotationSets this Actor's rotation in the game world
SetRelativeLocationSets this Actor's relative location in local space (only if this actor is attached)
SetRelativeRotationSets this Actor's relative rotation in local space (only if this actor is attached)
SetScaleSets this Actor's scale
SetNetworkAuthoritySets the Player to have network authority over this Actor
SetNetworkAuthorityAutoDistributedSets if this Actor will auto distribute the network authority between players
TranslateToSmoothly moves this actor to a location over a certain time
RotateToSmoothly rotates this actor to an angle over a certain time
booleanIsBeingDestroyedReturns true if this Actor is being destroyed
booleanIsVisibleReturns true if this Actor is visible
booleanIsGravityEnabledReturns true if gravity is enabled on this Actor
booleanIsInWaterReturns true if this Actor is in water
booleanIsNetworkDistributedReturns true if this Actor is currently network distributed
table of Base ActorGetAttachedEntitiesGets all Actors attached to this Actor
Base Actor or nilGetAttachedToGets the Actor this Actor is attached to
tableGetBoundsGets this Actor's bounds
CollisionTypeGetCollisionGets this Actor's collision type
VectorGetLocationGets this Actor's location in the game world
VectorGetRelativeLocationGets this Actor's Relative Location if it's attached
Player or nilGetNetworkAuthorityGets this Actor's Network Authority Player
RotatorGetRotationGets this Actor's angle in the game world
RotatorGetRelativeRotationGets this Actor's Relative Rotation if it's attached
VectorGetForceGets this Actor's force (set by SetForce())
integerGetDimensionGets this Actor's dimension
booleanHasNetworkAuthorityReturns true if the local Player is currently the Network Authority of this Actor
booleanHasAuthorityGets if this Actor was spawned by the client side
VectorGetScaleGets this Actor's scale
VectorGetVelocityGets this Actor's current velocity
AddActorTagAdds an Unreal Actor Tag to this Actor
RemoveActorTagRemoves an Unreal Actor Tag from this Actor
table of stringGetActorTagsGets all Unreal Actor Tags on this Actor
booleanWasRecentlyRenderedGets if this Actor was recently rendered on screen
floatGetDistanceFromCameraGets the distance of this Actor from the Camera
floatGetScreenPercentageGets the percentage of this Actor size in the screen
Inherited Paintable Functions
Base Paintablescripting-reference/classes/base-classes/Paintable
ReturnsNameDescription
SetMaterialSets the material at the specified index of this Actor
SetMaterialFromCanvasSets the material at the specified index of this Actor to a Canvas object
SetMaterialFromSceneCaptureSets the material at the specified index of this Actor to a SceneCapture object
SetMaterialFromWebUISets the material at the specified index of this Actor to a WebUI object
ResetMaterialResets the material from the specified index to the original one
SetMaterialColorParameterSets a Color parameter in this Actor's material
SetMaterialScalarParameterSets a Scalar parameter in this Actor's material
SetMaterialTextureParameterSets a texture parameter in this Actor's material to an image on disk
SetMaterialVectorParameterSets a Vector parameter in this Actor's material
SetPhysicalMaterialOverrides this Actor's Physical Material with a new one
Inherited Damageable Functions
Base Damageablescripting-reference/classes/base-classes/Damageable
ReturnsNameDescription
integerApplyDamageDo damage to this entity
integerGetHealthGets the current health
integerGetMaxHealthGets the Max Health
RespawnRespawns the Entity, fullying it's Health and moving it to it's Initial Location
SetHealthSets the Health of this Entity
SetMaxHealthSets the MaxHealth of this Entity
ReturnsNameDescription
AddSkeletalMeshAttachedSpawns and Attaches a SkeletalMesh into this Character
AddStaticMeshAttachedSpawns and Attaches a StaticMesh into this Character
DropDrops any Pickable the Character is holding
JumpTriggers this Character to jump
PickUpGives a Melee/Grenade/Weapon (Pickable) to the Character
PlayAnimationPlays an Animation Montage on this character
StopAnimationStops an Animation Montage on this character
RemoveSkeletalMeshAttachedRemoves, if existing, a SkeletalMesh from this Character given it's custom ID
RemoveStaticMeshAttachedRemoves, if existing, a StaticMesh from this Character given it's custom ID
RemoveAllStaticMeshesAttachedRemoves all StaticMeshes attached
RemoveAllSkeletalMeshesAttachedRemoves all SkeletalMeshes attached
SetDeathSoundChanges the Death sound when Character dies
SetMeshChanges the Character Mesh on the fly
SetInputEnabledEnables/Disables Character's Input
SetPainSoundChanges the Pain sound when Character takes damage
SetRagdollModeSets Character Ragdoll Mode
SetTeamSets a Team which will disable damaging same Team Members
booleanIsInRagdollModeGets if Character is in ragdoll mode
booleanIsInputEnabledGets if has input enabled
tableGetBoneTransformGets a Bone Transform in world space given a bone name
SkeletalMesh ReferenceGetMeshGets the Skeletal Mesh Asset
Player or nilGetPlayerGets the possessing Player
integerGetTeamGets the Team
EnterVehicleForces a Character to enter into a vehicle

AddSkeletalMeshAttached​

Spawns and Attaches a SkeletalMesh into this Character, the SkeletalMesh must have the same Skeletal used by the Character Mesh, and will follow all animations from it. Uses a custom ID to be used for removing it further.

For customizing the Materials specific of a SkeletalMeshAttached, please use the following syntax in the Paintable methods: attachable///[ATTACHABLE_ID]/[PARAMETER_NAME], where [ATTACHABLE_ID] is the ID of the Attachable, and [PARAMETER_NAME] is the name of the parameter you want to change.

my_hcharacter:AddSkeletalMeshAttached(id, skeletal_mesh_asset?)
TypeParameterDefaultDescription
stringidUsed further for removing or applying material settings on it
SkeletalMesh Referenceskeletal_mesh_asset?

AddStaticMeshAttached​

Spawns and Attaches a StaticMesh into this Character in a Socket with relative Location and Rotation. Uses a custom ID to be used for removing it further

For customizing the Materials specific of a StaticMeshAttached, please use the following syntax as the parameter_name in the Paintable methods: attachable///[ATTACHABLE_ID]/[PARAMETER_NAME], where [ATTACHABLE_ID] is the ID of the Attachable, and [PARAMETER_NAME] is the name of the parameter you want to change.

my_hcharacter:AddStaticMeshAttached(id, static_mesh_asset?, socket?, relative_location?, relative_rotation?)
TypeParameterDefaultDescription
stringidUsed further for removing or applying material settings on it
StaticMesh Referencestatic_mesh_asset?
stringsocket?
Vectorrelative_location?Vector(0, 0, 0)
Rotatorrelative_rotation?Rotator(0, 0, 0)

Drop​

Drops any Pickable the Character is holding

my_hcharacter:Drop()

Jump​

Triggers this Character to jump

my_hcharacter:Jump()

PickUp​

Gives a Melee/Grenade/Weapon (Pickable) to the Character

my_hcharacter:PickUp(pickable)
TypeParameterDefaultDescription
Base Pickablepickable

PlayAnimation​

Plays an Animation Montage on this character

my_hcharacter:PlayAnimation(animation_path, slot_type?, loop_indefinitely?, blend_in_time?, blend_out_time?, play_rate?, stop_all_montages?)
TypeParameterDefaultDescription
Animation Referenceanimation_path
AnimationSlotTypeslot_type?AnimationSlotType.FullBody
booleanloop_indefinitely?false
floatblend_in_time?0.25
floatblend_out_time?0.25
floatplay_rate?1.0
booleanstop_all_montages?falseStops all running Montages from the same Group

StopAnimation​

Stops an Animation Montage on this character

my_hcharacter:StopAnimation(animation_asset)
TypeParameterDefaultDescription
Animation Referenceanimation_asset

RemoveSkeletalMeshAttached​

Removes, if existing, a SkeletalMesh from this Character given it's custom ID

my_hcharacter:RemoveSkeletalMeshAttached(id)
TypeParameterDefaultDescription
stringid

RemoveStaticMeshAttached​

Removes, if existing, a StaticMesh from this Character given it's custom ID

my_hcharacter:RemoveStaticMeshAttached(id)
TypeParameterDefaultDescription
stringid

RemoveAllStaticMeshesAttached​

Removes all StaticMeshes attached

my_hcharacter:RemoveAllStaticMeshesAttached()

RemoveAllSkeletalMeshesAttached​

Removes all SkeletalMeshes attached

my_hcharacter:RemoveAllSkeletalMeshesAttached()

SetDeathSound​

Changes the Death sound when Character dies

my_hcharacter:SetDeathSound(sound_asset)
TypeParameterDefaultDescription
stringsound_asset

SetMesh​

Changes the Character Mesh on the fly

my_hcharacter:SetMesh(skeletal_mesh_asset)
TypeParameterDefaultDescription
SkeletalMesh Referenceskeletal_mesh_asset

SetInputEnabled​

Enables/Disables Character's Input

my_hcharacter:SetInputEnabled(is_enabled)
TypeParameterDefaultDescription
booleanis_enabled

SetPainSound​

Changes the Pain sound when Character takes damage

my_hcharacter:SetPainSound(sound_asset)
TypeParameterDefaultDescription
Sound Referencesound_asset

SetRagdollMode​

Sets Character Ragdoll Mode

my_hcharacter:SetRagdollMode(ragdoll_enabled)
TypeParameterDefaultDescription
booleanragdoll_enabled

SetTeam​

Sets a Team which will disable damaging same Team Members

my_hcharacter:SetTeam(team)
TypeParameterDefaultDescription
integerteam0 is neutral and default

IsInRagdollMode​

Gets if Character is in ragdoll mode

— Returns boolean.

local ret = my_hcharacter:IsInRagdollMode()

IsInputEnabled​

Gets if has input enabled

— Returns boolean.

local ret = my_hcharacter:IsInputEnabled()

GetBoneTransform​

Gets a Bone Transform in world space given a bone name

— Returns table (with this format).

local ret = my_hcharacter:GetBoneTransform(bone_name)
TypeParameterDefaultDescription
stringbone_name

GetMesh​

Gets the Skeletal Mesh Asset

— Returns SkeletalMesh Reference.

local ret = my_hcharacter:GetMesh()

GetPlayer​

Gets the possessing Player

— Returns Player or nil.

local ret = my_hcharacter:GetPlayer()

GetTeam​

Gets the Team

— Returns integer.

local ret = my_hcharacter:GetTeam()

EnterVehicle​

Forces a Character to enter into a vehicle

my_hcharacter:EnterVehicle(my_HSimpleVehicle, Seat?)
TypeParameterDefaultDescription
HSimpleVehiclemy_HSimpleVehicle
integerSeat?0

Events​

Inherited Entity Events
Base Entityscripting-reference/classes/base-classes/Entity
NameDescription
SpawnTriggered when an Entity is spawned/created
DestroyTriggered when an Entity is destroyed
ValueChangeTriggered when an Entity has a value changed with :SetValue()
ClassRegisterTriggered when a new Class is registered with the Inheriting System
Inherited Actor Events
Base Actorscripting-reference/classes/base-classes/Actor
NameDescription
SpawnTriggered when an Entity is spawned/created
DestroyTriggered when an Entity is destroyed
ValueChangeTriggered when an Entity has a value changed with :SetValue()
ClassRegisterTriggered when a new Class is registered with the Inheriting System
Inherited Damageable Events
Base Damageablescripting-reference/classes/base-classes/Damageable
NameDescription
SpawnTriggered when an Entity is spawned/created
DestroyTriggered when an Entity is destroyed
ValueChangeTriggered when an Entity has a value changed with :SetValue()
ClassRegisterTriggered when a new Class is registered with the Inheriting System
NameDescription
AnimationBeginNotifyWhen an Animation Montage Notify begins
AnimationEndNotifyWhen an Animation Montage Notify ends
DropWhen Character drops the currently picked up Pickable
FireWhen Character fires a Weapon
GrabPropWhen Character grabs up a Prop
InteractTriggered when a Character interacts with a Prop or Pickable
PickUpWhen Character picks up anything
PossessWhen Character is possessed
RagdollModeChangeWhen Character enters or leaves ragdoll
AttemptReloadTriggered when this Character attempts to reload
ReloadWhen Character reloads a weapon
UnPossessWhen Character is unpossessed
PullUseTriggered when a Character presses the use button for a Pickable (i.e. clicks left mouse button with this equipped)
ReleaseUseTriggered when a Character releases the use button for a Pickable (i.e. releases left mouse button with this equipped)

AnimationBeginNotify​

When an Animation Montage Notify begins
HCharacter.Subscribe("AnimationBeginNotify", function(self, notify_name)
-- AnimationBeginNotify was called
end)
TypeArgumentDescription
Characterself
stringnotify_name

AnimationEndNotify​

When an Animation Montage Notify ends
HCharacter.Subscribe("AnimationEndNotify", function(self, notify_name)
-- AnimationEndNotify was called
end)
TypeArgumentDescription
Characterself
stringnotify_name

Drop​

When Character drops the currently picked up Pickable
HCharacter.Subscribe("Drop", function(self, object, triggered_by_player)
-- Drop was called
end)
TypeArgumentDescription
Characterself
Base Pickableobject
booleantriggered_by_player

Fire​

When Character fires a Weapon
HCharacter.Subscribe("Fire", function(self, weapon)
-- Fire was called
end)
TypeArgumentDescription
Characterself
Weaponweapon

GrabProp​

When Character grabs up a Prop
HCharacter.Subscribe("GrabProp", function(self, prop)
-- GrabProp was called
end)
TypeArgumentDescription
Characterself
Propprop

Interact​

Triggered when a Character interacts with a Prop or Pickable

Return false to prevent it
HCharacter.Subscribe("Interact", function(self, object)
-- Interact was called
end)
TypeArgumentDescription
Characterself
Prop or Base Pickableobject

PickUp​

When Character picks up anything
HCharacter.Subscribe("PickUp", function(self, object)
-- PickUp was called
end)
TypeArgumentDescription
Characterself
Base Pickableobject

Possess​

When Character is possessed
HCharacter.Subscribe("Possess", function(self, possesser)
-- Possess was called
end)
TypeArgumentDescription
Characterself
Playerpossesser

RagdollModeChange​

When Character enters or leaves ragdoll
HCharacter.Subscribe("RagdollModeChange", function(self, old_state, new_state)
-- RagdollModeChange was called
end)
TypeArgumentDescription
Characterself
booleanold_state
booleannew_state

AttemptReload​

Triggered when this Character attempts to reload

Return false to prevent it
HCharacter.Subscribe("AttemptReload", function(self, weapon)
-- AttemptReload was called
end)
TypeArgumentDescription
Characterself
Weaponweapon

Reload​

When Character reloads a weapon
HCharacter.Subscribe("Reload", function(self, weapon, ammo_to_reload)
-- Reload was called
end)
TypeArgumentDescription
Characterself
Weaponweapon
integerammo_to_reload

UnPossess​

When Character is unpossessed
HCharacter.Subscribe("UnPossess", function(self, old_possesser)
-- UnPossess was called
end)
TypeArgumentDescription
Characterself
Playerold_possesser

PullUse​

Triggered when a Character presses the use button for a Pickable (i.e. clicks left mouse button with this equipped)
HCharacter.Subscribe("PullUse", function(self, pickable)
-- PullUse was called
end)
TypeArgumentDescription
CharacterselfThe Character that used it
Base PickablepickableThe Pickable which has just been used

ReleaseUse​

Triggered when a Character releases the use button for a Pickable (i.e. releases left mouse button with this equipped)
HCharacter.Subscribe("ReleaseUse", function(self, pickable)
-- ReleaseUse was called
end)
TypeArgumentDescription
CharacterselfThe Character that stopped using it
Base PickablepickableThe Pickable which has just stopped being used