[TUT] Animations

Animations can give another look to an modification. In this tutorial i will show what i know about animations in GTA IV, you can download the code of this tutorial here and download the list of GTA IV animation here.

We have an big list of animations to use and thanks to the people involved in OpenIV development we can see those animations without the game running, it's very useful, you can find this option in the OpenIV menu Tools > Animation Viewer:


In the next screen we can choose what kind of animation we want preview:


Clicking in Ped animations (anim.img) we will be redirected to an screen that organizes the animations by their categories:


Clicking in one of the categories we will see an new screen with an Ped in center and the list of animations in the left side, if we click one of the animations the OpenIV will start playing the animation in loop mode:



Now to make this happen in game we can do with basically two ways:
  • Using scripthook classes
  • Using native method calls


Using Scripthook classes to play animations

To play animations using the scripthook we need:
  • An animation set: This object will determine the category of the animation
  • The Animation object that each Ped have, or the Ped's Task.PlayAnimation object
Simple example:


Here I'm declaring the animation set of the category swimming, then playing the animation idle from this category, the number 8 represents the speed of the playback, this param don't seems to affect the playback all the time, seems to work only in the start.

Result:

Popular posts from this blog

GTA V - NIBMods menu download

GTA V Meteors NIB Style

ScripthookVDotNet and NIBMods menu troubleshooting