entity: The target entity (e.g., a player or an NPC) that will have its animation current time set.
animDict: The animation dictionary containing the desired animation.
animName: The name of the animation you'd like to control.
currentTime: A float value between 0.0 and 1.0, which represents the position in the animation.
Keep in mind that RequestAnimDict should be used before trying to manipulate animDict.
Here is an example to demonstrate how to slow down an animation and control its progress:
-- Define the target entity, animation dictionary, and animation name
local entity = PlayerPedId() -- This is the player's entity
local animDict = "random@drunk_driver_1"
local animName = "drunk_fall"
-- Load the animation dictionary
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Citizen.Wait(0)
end
-- Start the animation
TaskPlayAnim(entity, animDict, animName, 8.0, -8.0, -1, 0, 1.0, false, false, false)
-- Slow down the animation
SetEntityAnimSpeed(entity, animDict, animName, 0.5) -- Slow down the animation to 0.5 times the normal speed
-- Control how far through the animation is played
Citizen.SetTimeout(2000, function()
SetEntityAnimCurrentTime(entity, animDict, animName, 0.5) -- Set the current animation's timestamp to 0.5 (halfway)
end)
This example will play a drunk falling animation at half speed and set its progress to half after 2 seconds.