[Tut] Gta 5 - Playing Together With Treatment Animations

Playing Ped animations

To play Ped animations inwards V nosotros seems to exclusively bring 1 selection (at to the lowest degree my tests amongst other methods didn't worked :) ), nosotros demand to chore the Ped to play the animation.

This is the method: TASK_PLAY_ANIM

Native.Function.Call(Native.Hash.TASK_PLAY_ANIM, thePed, sDict, sAnim, speed, speed * -1, -1, flags, 0, False, bDisableLegIK, False)

The params description (seems to be):

thePed, - The Ped that volition play the animation
sDict,  - The lexicon where the anim is located
sAnim,  - The anim name
speed,  - The play foremost speed (This is of import to brand shine changes betwixt anims)
speed * -1, - I don't know what precisely is, but inwards my tests travel fine this way
-1,  - Unknown
flags, - Flags that you lot tin give the axe laid for the playback, simply about of them are described simply about lines below
0,  - Unknown
False,  - Unknown
bDisableLegIK,  - If the anim volition ignore the leg/foot interaction amongst obstacles
False) - Unknown

Flags that i constitute based on my tests:

        normal = 0
        repeat = 1
        stop_last_frame = 2
        unk1 = 4
        unk2_air = 8
        upperbody = 16
        enablePlCtrl = 32
        unk3 = 64
        cancelable = 128
        unk4_creature = 256
        unk5_freezePos = 512
        unk6_rot90 = 1024

You tin give the axe inwardness them to brand combination of flags.

In the Speed param of initial playback i ordinarily role 8.0, industrial plant fine inwards dandy business office of situations.

You volition discovery a sum (seems to be) listing of the lexicon in addition to anim names here:

Important: You demand to asking the animation Dictionary earlier foremost using it inwards your script:

Native.Function.Call(Native.Hash.REQUEST_ANIM_DICT, sDict)
sDict - The anim dictionary

To banking corporation tally if the Dictionary was loaded you lot tin give the axe use:

Native.Function.Call(Of Boolean)(Native.Hash.HAS_ANIM_DICT_LOADED, sDict)
sDict - The anim dictionary

Handling the animations

To handgrip the anims nosotros bring simply about interesting methods like:


thePed,  - Ped playing the anim
sDict,  - Anim dictionary
sAnim,  - Anim name
speed) - Stop speed, used for smoothness control

Native.Function.Call(Of Boolean)(Native.Hash.IS_ENTITY_PLAYING_ANIM
theEntity,  - Entity/Ped playing the anim
sDict,  - Anim dictionary
sAnim,  - Anim name
3) - Unknown

Native.Function.Call(Of Double)(Native.Hash.GET_ENTITY_ANIM_CURRENT_TIME
theEntity, - Entity/Ped playing the anim
sDict, - Anim dictionary
sAnim) - Anim name

Obs.: The fourth dimension returned is a number betwixt 0.0 in addition to 1.0 (ex.: 0.35), it correspond how much pct of sum playback was played, 0.35 for event agency 35% ;)

theEntity, - Entity/Ped playing the anim
sDict, - Anim dictionary
sAnim - Anim name
time) - New time

Obs.: The fourth dimension param hither role same persuasion every bit the provide of GET_ENTITY_ANIM_CURRENT_TIME method, so, to laid anim to one-half playback fourth dimension you lot should role 0.5 for example.

theEntity, - Entity/Ped playing the anim
sDict, - Anim dictionary
sAnim - Anim name
speedCoef) - New speed coefficient, the default is 1.0


-The cognition present inwards this post service is number of my tests, zilch official, simply about details/params may live wrong, simply about of import info/methods may live missing inwards this post service :)

-The fact nosotros demand to role a Task to play ped anims brand somethings to a greater extent than difficult, sometimes nosotros demand to telephone hollo upward a CLEAR_PED_TASKS_IMMEDIATELY earlier endeavour to chore the Ped to play the anim.

-The method PLAY_ENTITY_ANIM didn't worked inwards my tests, peradventure im doing something incorrect :(, this is in all likelihood the best method to strength a anim playback.

-It's expert bring a pocket-sized fourth dimension expression (i role 100ms) earlier endeavour to retask the ped to play the anim again, if you lot leave of absence along retasking the ped it may non play the anim due to tasks "override", amongst lower FPS this number is bigger.

You tin give the axe discovery to a greater extent than animation related methods inwards the "Bible" of V native methods:


In this event i volition chore the ped to play a anim, become his playback time, reset his playback fourth dimension in addition to bring down the play speed:

Obs.: The event exclusively contains business office of a script, but you lot already know that, right? ^^

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel