Log in to reply
 

Tutorial for making Animation on command?



  • I'm trying to make a simple gesture animation (ex. wave hand) by pressing a custom key, but I could'nt seem to find a proper thread anywhere .. any help guys?



  • Before we go, are you interested in writing your own scripts? If so, you might want to download the free version of Microsoft Visual Studio. If not, here are the general steps. Holler if you need more help.

    1. You will need Scripthook (including dinput8.dll) and the 2 Scripthook dot net files.
    2. You will create a script with basically one line of code in C# with some extra fluff. This line will go in a plain text file, that you can name whatever you want, but will end in .cs (as in c sharp).
    3. This file will go in a folder called Scripts ( a subfolder of where GTA V is installed).
    4. You can then hit whatever key you bound to do the wave gesture.

    Also you need to choose which animation wave gesture you want.
    Sorry not to be more specific but not sure which step you are at, and there are quite a few, all very simple, before you can do the real work...and it is fun and rewarding.
    Again you need to decide if you want to learn how to script.

    I write in VB.NET, but this is what the line of code would look like. There are scenarios and animations. This is an animation without the rest of the fluff like declarations. Kind of gross.

    PedPlayer.Task.PlayAnimation("anim@mp_player_intcelebrationmale@nose_pick", "nose_pick")

    A good resource for what's available. Search for "wave" I guess.

    https://alexguirre.github.io/animations-list/



  • Here. This is simplified to the max. If your GTA is ready for scripting (see steps above), just dump this in notepad or another text editor, name it Wave.VB or whatever as long as it ends in VB.
    Then use the / (forward slash) on the numeric keyboard to get the character to wave. There are 2 wave animations in the file just to give you an idea. If you don't want to use the / key, just replace it. Code does not need to be compiled, it will get compiled from the text file.

    # code block
    Imports System
    Imports System.Windows.Forms
    Imports GTA : Imports GTA.Math : Imports GTA.Native
    
    Public Class BaseScript
    
        Inherits Script
    
        Private Sub OnkeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp
    
            If e.KeyCode = 111 Then
            Game.Player.Character.Task.PlayAnimation("anim@mp_player_intcelebrationfemale@wave", "wave")
    		wait(4000)	'wait 4 seconds in ms
    		Game.Player.Character.Task.PlayAnimation("anim@mp_player_intcelebrationmale@wave", "wave")     
    End If
    
        End Sub
    End Class

Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.