Skip to content

Playing animations

in0finite edited this page Feb 28, 2019 · 1 revision

There are 2 ways to play anim:

  • using it's ifp file name and anim name

  • using it's anim group and index


Ifp file name and anim name

PedModel.PlayAnim (fileName, animName);

For example:

PedModel.PlayAnim ("ped", "roadcross");

this will play anim which is located in ped.ifp, and which is called roadcross

Anim groups

Anims can be placed in groups. The idea is that peds' anims can be grouped, so that using the same index, you can play different anims for different ped groups.

For example, if you use AnimGroup.WalkCycle as anim group, and AnimIndex.Walk as index, then when ped is a man, 'walk_civi' will be played, and when ped is a woman, 'woman_walknorm' will be played.

Anim groups are defined inside /Data/auxanimgrp.dat file. You can read more about file structure in that file.

If you want to add new anims, you can add them to existing group, or create new group. After you added them to a file, you will need to update AnimGroup and AnimIndex enumerations, so that you can play those anims.

Example for playing walk anim:

PedModel.PlayAnim (AnimGroup.WalkCycle, AnimIndex.Walk)

Previewing anims

You can preview anims in game, from Animations window. Make sure "override player anims" is checked, and click on anim to play it.