YaCharacterAPI
YaCharacterAPI manages Characters in the game.
Characters are player-controlled avatars or NPCs in the scene.Functions
boolean YaCharacterAPI.IsPlayerCharacter(YaEntity entity)
ReturnsTrue if, is player character
Checks if the entity is controlled by the player.entityEntity
YaEntity YaCharacterAPI.GetPlayerEntity(YaEntity characterEntity)
ReturnsPlayer Entity
Gets the player entity.characterEntityCharacter entity
void YaCharacterAPI.OnPush(function callbackYaEntity, YaEntity, float3, number)
SERVER ONLY
Fired when the Character is pushed
callbackCallback functiontargetThe target Character to be pushedtriggerThe entity that pushes the CharacterdirectionThe direction in which the Character is pusheddistanceThe distance at which the Character is pushed
void YaCharacterAPI.OnFall(function callbackYaEntity, number)
SERVER ONLY
Fired when the Character falls
callbackCallback functiontargetThe target Character to fallfall heightFall height
void YaCharacterAPI.OnGround(function callbackYaEntity, number)
SERVER ONLY
Fired when the Character lands on the ground
callbackCallback functiontargetThe target Character landing on the groundfall heightFall height
void YaCharacterAPI.OnStartSwim(function callbackYaEntity)
SERVER ONLY
Fired when the character starts swimming
callbackCallback functiontargetThe target Character that starts swimming
void YaCharacterAPI.OnEndSwim(function callbackYaEntity)
SERVER ONLY
Fired when the character stops swimming
callbackCallback functiontargetThe target Character that stops swimming
void YaCharacterAPI.OnEnterHit(YaEntity character, function callbackYaEntity, number, float3)
Character hit enter
charactercharactercallbackCallback functionhitEntityHit entitysiteThe site of contact 0:side 1:Up -1:DownnormalThe normal direction of the contact point
void YaCharacterAPI.OnExitHit(YaEntity character, function callbackYaEntity)
Character hit exit
characterCharactercallbackCallback functionhitEntityHit entity
void YaCharacterAPI.OnPush(YaEntity character, function callbackYaEntity, float3, number)
Current character be pushed event
characterCharactercallbackCallback functionpusherThe entity that pushes the CharacterdirectionThe direction in which the Character is pusheddistanceThe distance at which the Character is pushed
void YaCharacterAPI.OnFall(YaEntity character, function callbacknumber)
Current character fall event
characterCharactercallbackCallback functionfallHeightFall height
void YaCharacterAPI.OnGround(YaEntity character, function callbacknumber)
The current character landing event
characterCharactercallbackCallback functionfallHeightFall height
boolean YaCharacterAPI.IsCharacter(YaEntity entity)
ReturnsTrue if the entity is a Character
Checks if the entity is a Character.entityEntity
boolean YaCharacterAPI.IsDead(YaEntity entity)
ReturnsTrue if the Character is dead
True if the Character is dead, otherwise false.entityEntity
number YaCharacterAPI.GetCurrentMoveSpeed(YaEntity character)
ReturnsMove speed (m/s)
Get current move speed. Returns only the movement speed in the horizontal directioncharacterCharacter
number YaCharacterAPI.GetCurrentMoveDirection(YaEntity character)
ReturnsIn y-rotation radians
Gets the direction of the character's movement, expressed in y-rotation radians.
The direction of movement may differ from the direction of character rotation if the character is retreatedcharacterCharacter
number YaCharacterAPI.GetCurrentVerticalSpeed(YaEntity character)
ReturnsSpeed (m/s)
Gets the speed in the current verticalcharacterCharacter
boolean YaCharacterAPI.IsGrounded(YaEntity character)
ReturnsIs true, character is on the ground
Whether the character is on the groundcharacterCharacter
boolean YaCharacterAPI.IsJumping(YaEntity character)
ReturnsIs true, character is jumping
Whether the character is jumpingcharacterCharacter
boolean YaCharacterAPI.IsMoving(YaEntity character)
ReturnsIs true, character is moving
Whether the character is movingcharacterCharacter
boolean YaCharacterAPI.IsWalking(YaEntity character)
ReturnsIs true, character is walking
Whether the character is walkingcharacterCharacter
boolean YaCharacterAPI.IsRunning(YaEntity character)
ReturnsIs true, character is running
Whether the character is runningcharacterCharacter
boolean YaCharacterAPI.IsSwimming(YaEntity character)
ReturnsIs true, character is swimming
Whether the character is swimmingcharacterCharacter
void YaCharacterAPI.SetWalkMaxSpeed(YaEntity character, number value)
Set the maximum walking speed
characterCharactervalueMax speed (m/s)
number YaCharacterAPI.GetWalkMaxSpeed(YaEntity character)
ReturnsSpeed (m/s)
Gets the current walking speedcharacterCharacter
void YaCharacterAPI.SetRunMaxSpeed(YaEntity character, number value)
Set the maximum running speed
characterCharactervalueMax speed (m/s)
number YaCharacterAPI.GetRunMaxSpeed(YaEntity character)
ReturnsSpeed (m/s)
Get the maximum running speedcharacterCharacter
void YaCharacterAPI.SetJumpHeight(YaEntity character, number value)
Set the jump height
characterCharactervalueJump height
number YaCharacterAPI.GetJumpHeight(YaEntity character)
Returnsjump height
Gets the height of the current maximum jumpcharacterCharacter
void YaCharacterAPI.SetNumberOfJump(YaEntity character, number value)
Set the number of consecutive jumps
charactercharactervalueNumber Of Jump
number YaCharacterAPI.GetNumberOfJump(YaEntity character)
ReturnsNumber Of Jump
Gets the number of consecutive jumpscharactercharacter
void YaCharacterAPI.SetGravity(YaEntity character, number value)
Set the Character gravity value. Affects fall speed
characterCharactervalueGravity
number YaCharacterAPI.GetGravity(YaEntity character)
ReturnsGravity
Gets the gravity value that affects the CharactercharacterCharacter
boolean YaCharacterAPI.Equip(YaEntity character, YaEntity entity, YaEquipParameter parameter)
ReturnsWhether the equipment was successful
Equip an Entity to Character.characterCharacterentityThe entity to be equippedparameterExtra parameters
boolean YaCharacterAPI.EquipTool(YaEntity character, YaEntity entity)
ReturnsWhether the equipment was successful
Equip a Tool Entity to Character.characterCharacterentityTool
boolean YaCharacterAPI.Unequip(YaEntity character, YaEntity entity)
ReturnsWhether the unequip was successful
Unload an Entity from the CharactercharactercharacterentityThe entity to be unequipped
YaEntity YaCharacterAPI.GetEquipByPoint(YaEntity character, number bonePoint)
ReturnsEquipped entity
Returns an entity somewhere on the character.characterCharacterbonePointBonePoint
YaEntity YaCharacterAPI.GetToolByHand(YaEntity character)
ReturnsTool entity
Gets the tool in the Character's hand.characterCharacter
YaEntity YaCharacterAPI.GetToolByBonePoint(YaEntity character, number point)
ReturnsTool entity
Gets the tool on the binding point.characterCharacter entitypointBinding bone point
Array<YaEntity> YaCharacterAPI.GetToolsByBonePoint(YaEntity character, number point)
ReturnsTool list
Gets all tools on the binding point.characterCharacter entitypointBinding bone point
Array<YaEntity> YaCharacterAPI.GetAllTools(YaEntity character)
ReturnsAll tools
Gets all tools on the CharactercharacterCharacter entity