Character
A character object in Ratchet represents an online player.
Members
Characters have only one variable member, which is ID - this is the same number as Character Unique ID in the DevKit (see the image below) and also as the database ID.
It is also used in Tot scripts as a backend variable to represent players. Therefore you can freely convert this number to a player and a player to this ID in Tot scripts.
And in Ratchet plugins you can also use getPlayerFromID to create a character object from this ID, which is the only way to construct a character object without retrieving it from events or from functions like getPlayersInRadius.

getPlayerFromID function
Create a character object from the player's database ID.
Syntax:
Character|nil getPlayerFromID( int id )Example:
local player = getPlayerFromID(301)
print(type(player))getPlayerFromName function
Find a player by their character's real name (this will ignore /act names and similar).
Syntax:
Character|nil getPlayerFromName( string name )Example:
local player = getPlayerFromName("Bob")
print(type(player))getPlayersInRadius function
Returns a table with all players in radius of specified number of tiles from a vector position.
Syntax:
table<Character> getPlayersInRadius( Vector position, float radius )Example:
-- all players in radius of 10 tiles from the caster
local players = getPlayersInRadius(caster:GetPosition(), 10)getAllPlayers function
Returns a table of all players online on the server.
Syntax:
table<Character> getAllPlayers()getPlayerCount function
Returns a number of online players on the server.
Syntax:
int getPlayerCount()IsValid function
Checks whether the character reference is still valid and the player is online.
Syntax:
bool Character:IsValid()GetName function
Returns a display name of a character. This will use /act name if applicable.
Syntax:
string Character:GetName()Example:
local name = player:GetName()
print(name)GetRealName function
Returns the actual character name as it exists in the database (ignoring /act and similar).
Syntax:
string Character:GetRealName()Example:
local name = player:GetRealName()
print(name)GetSteamID function
Returns SteamID64 (decimal), it is just a long number, but it is saved as a string.
Syntax:
string Character:GetSteamID()Example:
local steamId = player:GetSteamID()
print(steamId)GetGuildID function
Returns the database ID of a clan the player is a member of.
Syntax:
int Character:GetGuildID()Example:
local guildId = player:GetGuildID()
print(guildId)GetGuild function
Syntax:
Guild Character:GetGuild()GetPosition function
Returns a vector of the current coordinates of player's position in the game world.
Syntax:
Vector Character:GetPosition()GetFeetPosition function
Syntax:
Vector Character:GetFeetPosition()Example:
local position = player:GetPosition()
print(position.x, position.y, position.z)GetRotation function
Syntax:
Rotator Character:GetRotation()GetHeight function
Syntax:
float Character:GetHeight()GetHalfHeight function
Syntax:
float Character:GetHalfHeight()GiveItem function
Syntax:
bool Character:GiveItem( int itemId [, int quantity = 1 ] )Notify function
Shows a HUD notification to a player.
Syntax:
void Character:Notify( string icon, string text [, Color iconColor ] )Available icons:
These beautiful icons come from Phosphor Icons, permitted under MIT License.
ExecuteConsoleCommand function
Syntax:
void Character:ExecuteConsoleCommand( string command )CallComponentFunction function
Syntax:
void Character:CallComponentFunction( string componentName, string functionName )IsStanding function
Syntax:
bool Character:IsStanding()IsWalking function
Syntax:
bool Character:IsWalking()IsRiding function
Syntax:
bool Character:IsRiding()IsArmed function
Syntax:
bool Character:IsArmed()Freeze function
Freeze or unfreeze a player (restricting their movement).
Syntax:
void Character:Freeze( bool enable )PlayVoice function
Play a sound from the VoiceTable (such as voc_pain or voc_jump).
Syntax:
void Character:PlayVoice( string sound )PlayAnimation function
Play animation montage by path, such as:/Game/Characters/humans/animations/emotes/AM_emote_greet_salute.AM_emote_greet_salute
Syntax:
void Character:PlayAnimation( string path [, string startSection = "None", float playRate = 1.0 ] )StopAnimation function
Stop animation montage by path, or all animations if no path is specified
Syntax:
void Character:StopAnimation( [ string path = "" ] )