Skip to content

Actor ​

Actors represent objects that exist in the game world. Every player character, NPC, building piece, decoration, container, map object, mod controller, and even the sky is an actor.

Actor type in Ratchet is used to contain functions that are shared across all of those objects and can be used on any type that inherits from an actor.

spawnActor function ​

Syntax:

lua
Actor|nil spawnActor( string actorTypeOrPath, Vector location [, Rotator rotation ] )
Actor TypeLua Object
TotPuppetTotPuppet
TotBoxZoneTotZone
TotSphereZoneTotZone

DANGER

This feature is currently not working (Puppets/Zones will spawn but cannot be edited).

findActor function ​

Returns an actor instance (or nil) based on their name in the game world.

This will always return the general Actor type and never the specific class of an object.

Syntax:

lua
Actor|nil findActor( string name )

Example:

lua
local actor = findActor("MC_KnightsSanity_C_0")

WARNING

This is a heavy and potentially slow operation, it should not be used too often!

Additionally, working with unsupported UE actors can be dangerous. Only use this function if you know what you're doing. There is no downcasting in Ratchet (e.g. converting Actor to Character).

getActorsInRadius function ​

Syntax:

lua
table<Actor> getActorsInRadius( Vector location, float radius )

getActorsByClass function ​

Syntax:

lua
table<Actor> getActorsByClass( string path )

WARNING

This feature is currently not working, or maybe it does, but I have not yet figured out a path that works with it. Let me know if you happen to get it to work, so I can provide instructions.

IsValid function ​

Syntax:

lua
bool Actor:IsValid()

GetActorName function ​

Syntax:

lua
string Actor:GetActorName()

GetClassName function ​

Syntax:

lua
string Actor:GetClassName()

GetPathName function ​

Syntax:

lua
string Actor:GetPathName()

GetLocation function ​

Syntax:

lua
Vector Actor:GetLocation()

GetRotation function ​

Syntax:

lua
Rotator Actor:GetRotation()

SetLocation function ​

Syntax:

lua
bool Actor:SetLocation( Vector location, bool sweep, bool teleport )

SetRotation function ​

Syntax:

lua
bool Actor:SetRotation( Rotator rotation )

GetFeetLocation function ​

Syntax:

lua
Vector Actor:GetFeetLocation()

SetLocationAndRotation function ​

Syntax:

lua
bool Actor:SetLocationAndRotation( Vector location, Rotator rotation, bool sweep, bool teleport )

Teleport function ​

Syntax:

lua
bool Actor:Teleport( Vector location [, Rotator rotation ] )

GetDistanceTo function ​

Syntax:

lua
float Actor:GetDistanceTo( Actor other )

GetHorizontalDistanceTo function ​

Syntax:

lua
float Actor:GetHorizontalDistanceTo( Actor other )

GetVerticalDistanceTo function ​

Syntax:

lua
float Actor:GetVerticalDistanceTo( Actor other )

GetVelocity function ​

Syntax:

lua
Vector Actor:GetVelocity()

GetForwardVector function ​

Syntax:

lua
Vector Actor:GetForwardVector()

GetUpVector function ​

Syntax:

lua
Vector Actor:GetUpVector()

HasTag function ​

Syntax:

lua
bool Actor:HasTag( string tag )

IsOverlappingActor function ​

Syntax:

lua
bool Actor:IsOverlappingActor( Actor other )

GetEyesViewPoint function ​

Syntax:

lua
Vector, Rotator Actor:GetEyesViewPoint()

Destroy function ​

Syntax:

lua
void Actor:Destroy()

CallFunction function ​

This is equivalent to Call Function By Name in the DevKit.

Only use this if you know what you're doing.

Syntax:

lua
void Actor:CallFunction( string name )