Animation Client
Animation is a powerfull module to play animations in your script.
JO Variables
jo.animation.easeIn
Type : float:
A variable to set the ease in speed of animations
Default: 4.0
jo.animation.easeOut
Type : float
A variable to set the ease out speed of animations
Default: -4.0
JO Functions
jo.animation.faceEntity()
Turn the ped to face the target
Syntax
jo.animation.faceEntity(ped, target, waiter)Parameters
ped : integer
The ped to turn
target : integer
The target to face
waiter : boolean Optional
If need to reach the heading to end the function - default:true
Example
local ped = PlayerPedId()
local targetSource = 5
local targetEntity = GetPlayerPed(GetPlayerFromServerId(targetSource))
local waiter = true
jo.animation.faceEntity(ped, targetSource, targetEntity, waiter)jo.animation.goToCoords()
Function to move a ped to a destination
Syntax
jo.animation.goToCoords(ped, coords, speed, waiter, distanceToStop)Parameters
ped : integer
The ped to move
coords : vector
vec3 or vec4 - The coordinate of the destination
If vector4 is used, the ped will stop at the end and turn to the desired heading
speed : float Optional
The speed of the walk - default:1.0
waiter : boolean Optional
If need to wait the reach of location to end the function - default:false
distanceToStop : float Optional
The distance between the ped and the destination to stop it - default:0.0
Example
local ped = PlayerPedId()
local destination = vec4(1324.0, 234.0, 50.0, 180.0)
local speed = 2.0
local waiter = true
local distanceToStop = 3.0
jo.animation.goToCoords(ped, destination, speed, waiter, distanceToStop)jo.animation.load()
Load the dictionnary of animation
Syntax
jo.animation.load(dict, waiter)Parameters
dict : string
The dictionnary of the animation
waiter : boolean Optional
If need to wait the loading to end the function - default:false
Example
local dict = "cnv_camp@rchso@cnv@ccdtc33@player_karen"
local waiter = true
jo.animation.load(dict, waiter)jo.animation.play()
Play animation. The function load automatically necessary resources.
Syntax
jo.animation.play(ped, dict, name, duration, flag, offset)Parameters
ped : integer
The entity where the animation will be played
dict : string
The dictionnary of the animation
name : string
The name of the animation
duration : integer Optional
Duration of the animation in ms - default:-1
flag : integer Optional
The flag of the animation - default:0
offset : float Optional
The offset of the animation 0.0 <> 1.0 - default: 0.0
Return Value
Type : number
Example
local ped = PlayerPedId()
local dict = "cnv_camp@rchso@cnv@ccdtc33@player_karen"
local name = "arthur_dance_loop"
local duration = -1
local flag = 1
jo.animation.play(ped, dict, name, duration, flag)jo.animation.setDesiredHeading()
Turn the ped to the desired heading
Syntax
jo.animation.setDesiredHeading(ped, heading, waiter)Parameters
ped : integer
The ped to turn
heading : number
The desired heading
waiter : boolean Optional
If need to reach the heading to end the function - default:true
Example
local ped = PlayerPedId()
local heading = 180.0
local waiter = true
jo.animation.setDesiredHeading(ped, heading, waiter)jo.animation.waitTaskEnd()
Syntax
jo.animation.waitTaskEnd(ped, task)Example
local ped = PlayerPedId()
local coordinates = vec3(1324.0, 234.0, 50.0)
local speed = 1.0
local maxTime = -1
local radiusEnd = 2.0
local flags = 2 -- Slide at end
local finalHeading = 180.0
TaskFollowNavMeshToCoord(ped, coordinates, speed, maxTime, radiusEnd, flags, finalHeading)
local task = `SCRIPT_TASK_FOLLOW_NAV_MESH_TO_COORD`
jo.animation.waitTaskEnd(ped, task)
print('Task ended. Player reached the coordinates')