Calculadora de Flags de Animação
Escolha os comportamentos da animação e receba o inteiro de flags combinado para TaskPlayAnim / TaskPlayAnimAdvanced, com um snippet Lua pronto para colar.
Por enquanto, esta ferramenta e as notas dela estão em inglês.
31 flags · 3 set
Animation flag
AF_LOOPING | AF_UPPERBODY | AF_SECONDARY
TaskPlayAnim
local function LoadAnimDict(dict)
if not DoesAnimDictExist(dict) then return false end
RequestAnimDict(dict)
local timeout = GetGameTimer() + 5000
while not HasAnimDictLoaded(dict) do
if GetGameTimer() > timeout then return false end
Wait(0)
end
return true
end
local ANIM = {
dict = "missminuteman_1ig_2",
name = "handsup_base",
blendIn = 8.0, -- 1.0 slow, 8.0 instant
blendOut = 8.0,
duration = -1, -- ms, -1 = until stopped / clip length
flag = 49, -- AF_LOOPING | AF_UPPERBODY | AF_SECONDARY
playbackRate = 0.0, -- start phase 0.0 - 1.0
}
local function PlayAnim(ped)
if not LoadAnimDict(ANIM.dict) then
print(("Could not load anim dict %s"):format(ANIM.dict))
return
end
TaskPlayAnim(ped, ANIM.dict, ANIM.name, ANIM.blendIn, ANIM.blendOut, ANIM.duration, ANIM.flag, ANIM.playbackRate, false, false, false)
RemoveAnimDict(ANIM.dict) -- the running task keeps its own reference
end
RegisterCommand("anim", function()
local ped = PlayerPedId()
if IsEntityPlayingAnim(ped, ANIM.dict, ANIM.name, 3) then
StopAnimTask(ped, ANIM.dict, ANIM.name, ANIM.blendOut)
else
PlayAnim(ped)
end
end, false)TaskPlayAnim parameters
TaskPlayAnim(ped, animDict, animName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ)- blendInSpeed / blendOutSpeed: 1.0 is a slow blend, 8.0 is basically instant.
- duration: milliseconds.
-1plays the full clip, or forever when looping. - flag: the value from this calculator.
- playbackRate: really the start phase of the clip, 0.0 to 1.0. Use 0.0 to start at the beginning.
- lockX / lockY / lockZ: lock the ped's position on that axis, usually false.
Common combinations
| Value | Flags | Use |
|---|---|---|
0 | none | Full body, plays once. |
1 | AF_LOOPING | Full body loop, player is stuck until stopped. |
2 | AF_HOLD_LAST_FRAME | Plays once and freezes on the last frame. |
48 | AF_UPPERBODY | AF_SECONDARY | Upper body once, player can walk. |
49 | AF_LOOPING | AF_UPPERBODY | AF_SECONDARY | The usual emote flag: loops, player can walk. |
50 | AF_HOLD_LAST_FRAME | AF_UPPERBODY | AF_SECONDARY | Upper body pose that stays (hands up). |
Tips
- Upper body alone (
16) still blocks movement. AddAF_SECONDARY(32) to let the player walk. - Stop an animation with
StopAnimTask(ped, dict, name, blendOut)orClearPedTasks(ped). - Check that a dictionary exists with
DoesAnimDictExistbefore requesting it, and callRemoveAnimDictonce the task has started. - Browse dictionaries and clip names in theanimations list.
Flag names come from the eScriptedAnimFlags enum in the FiveM native docs. Based on the idea of Vespura's animation flags calculator, which covered the first six bits.
Mais ferramentas de calculadoras
Calculadora de Hash joaat
Converta qualquer string para o valor de GetHashKey (joaat) em signed, unsigned e hex, na hora.
Calculadora de Driving Style
Marque os comportamentos que você quer e receba o valor de flag de driving style para TaskVehicleDriveToCoord e afins.
Botões da Tela de Aviso
Calcule as flags de botões para telas de alerta do SetWarningMessage: aceitar, cancelar, tentar de novo e mais.
