From the reference libraryRedM

autodoc_client_functions

jo_libs/modules/animation/autodoc/autodoc_client_functions.md

autodoc_client_functions

JO Functions > jo.animation.faceEntity() > Syntax

jo.animation.faceEntity(ped, target, waiter)

JO Functions > jo.animation.faceEntity() > Parameters

ped : integer

The ped to turn

target : integer

The target to face

waiter : boolean <BadgeOptional />

If need to reach the heading to end the function - default:true

JO Functions > jo.animation.faceEntity() > Example

local ped = PlayerPedId()
local targetSource = 5
local targetEntity = GetPlayerPed(GetPlayerFromServerId(targetSource))
local waiter = true
jo.animation.faceEntity(ped, targetSource, targetEntity, waiter)

JO Functions > jo.animation.goToCoords()

Function to move a ped to a destination <br>

JO Functions > jo.animation.goToCoords() > Syntax

jo.animation.goToCoords(ped, coords, speed, waiter, distanceToStop)

JO Functions > jo.animation.goToCoords() > Parameters

ped : integer

The ped to move

coords : vector

vec3 or vec4 - The coordinate of the destination <br> If vector4 is used, the ped will stop at the end and turn to the desired heading

speed : number <BadgeOptional />

The speed of the walk - default:1.0

waiter : boolean <BadgeOptional />

If need to wait the reach of location to end the function - default:false

distanceToStop : number <BadgeOptional />

The distance between the ped and the destination to stop it - default:0.0

JO Functions > jo.animation.goToCoords() > 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 Functions > jo.animation.load() > Syntax

jo.animation.load(dict, waiter)

JO Functions > jo.animation.load() > Parameters

dict : string

The dictionnary of the animation

waiter : boolean <BadgeOptional />

If need to wait the loading to end the function - default:false

JO Functions > jo.animation.load() > Example

local dict = "cnv_camp@rchso@cnv@ccdtc33@player_karen"
local waiter = true
jo.animation.load(dict, waiter)


JO Functions > jo.animation.play()

Play animation. The function load automatically necessary resources. <br>

JO Functions > jo.animation.play() > Syntax

jo.animation.play(ped, dict, name, duration, flag, offset)

JO Functions > jo.animation.play() > 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 <BadgeOptional />

Duration of the animation in ms - default:-1

flag : integer <BadgeOptional />

The flag of the animation - default:0

offset : number <BadgeOptional />

The offset of the animation 0.0 <> 1.0 - default: 0.0

JO Functions > jo.animation.play() > Return Value

Type : number

JO Functions > jo.animation.play() > 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 Functions > jo.animation.setDesiredHeading()

Turn the ped to the desired heading <br>

JO Functions > jo.animation.setDesiredHeading() > Syntax

jo.animation.setDesiredHeading(ped, heading, waiter)

JO Functions > jo.animation.setDesiredHeading() > Parameters

ped : integer

The ped to turn

heading : number

The desired heading

waiter : boolean <BadgeOptional />

If need to reach the heading to end the function - default:true

JO Functions > jo.animation.setDesiredHeading() > Example

local ped = PlayerPedId()
local heading = 180.0
local waiter = true
jo.animation.setDesiredHeading(ped, heading, waiter)

JO Functions > jo.animation.waitTaskEnd() > Syntax

jo.animation.waitTaskEnd(ped, task)

JO Functions > jo.animation.waitTaskEnd() > 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')

JO Functions > jo.animation.play()

Play animation. The function load automatically necessary resources. <br>

:::details Flags list

Bit index Integer value Name Description
0 1 AF_LOOPING Loop the animation continuously
1 2 AF_HOLD_LAST_FRAME Freeze on the last frame when done
2 4 AF_NOT_INTERRUPTABLE Prevent other tasks from cancelling the animation
3 8 AF_UPPERBODY Play on upper body only (allows movement)
4 16 AF_SECONDARY Play as a secondary/blended animation
5 32 AF_ABORT_ON_PED_MOVEMENT Stop the animation when the ped moves
6 64 AF_ADDITIVE Blend additively on top of existing animations
7 128 AF_OVERRIDE_PHYSICS Override physics during playback
8 256 AF_EXTRACT_INITIAL_OFFSET Use the animation's initial position offset
9 512 AF_EXIT_AFTER_INTERRUPTED Exit cleanly when interrupted
10 1024 AF_TAG_SYNC_IN Sync entry tag with other peds
11 2048 AF_TAG_SYNC_OUT Sync exit tag with other peds
12 4096 AF_TAG_SYNC_CONTINUOUS Continuously sync tag with other peds
13 8192 AF_FORCE_START Force the animation to start immediately
14 16384 AF_USE_KINEMATIC_PHYSICS Use kinematic physics during playback
15 32768 AF_USE_MOVER_EXTRACTION Extract movement from the animation clip
16 65536 AF_DONT_SUPPRESS_LOCO Don't suppress locomotion during playback
17 131072 AF_ENDS_IN_DEAD_POSE Hold the final dead pose at the end
18 262144 AF_ACTIVATE_RAGDOLL_ON_COLLISION Trigger ragdoll on collision
19 524288 AF_DONT_EXIT_ON_DEATH Keep playing the animation after death
20 1048576 AF_ABORT_ON_WEAPON_DAMAGE Cancel the animation when the ped takes weapon damage
21 2097152 AF_DISABLE_FORCED_PHYSICS_UPDATE Disable forced physics updates during playback
22 4194304 AF_GESTURE Play as a gesture (short, non-blocking)
23 8388608 AF_SKIP_IF_BLOCKED_BY_HIGHER_PRIORITY_TASK Skip if a higher-priority task is active
24 16777216 AF_USE_ABSOLUTE_MOVER Use absolute world-space movement extraction
25 33554432 AF_0xC57F16E7 Unknown
26 67108864 AF_UPPERBODY_TAGS Apply upper body sync tags
27 134217728 AF_PROCESS_ATTACHMENTS_ON_START Process ped attachments at animation start
28 268435456 AF_EXPAND_PED_CAPSULE_FROM_SKELETON Expand the ped's collision capsule based on skeleton
29 536870912 AF_BLENDOUT_WRT_LAST_FRAME Blend out relative to the last frame position
30 1073741824 AF_DISABLE_PHYSICAL_ACTIVATION Disable physical activation events
31 2147483648 AF_DISABLE_RELEASE_EVENTS Disable release/end events for the animation

:::

JO Functions > jo.animation.play() > 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 <BadgeOptional />

Duration of the animation in ms - default:-1

flag : integer|table <BadgeOptional />

Animation flags - default:0. Pass an integer value or a table of bit indices (e.g. {0,3}

offset : number <BadgeOptional />

The offset of the animation 0.0 <> 1.0 - default: 0.0

Back to documentation