This article relates to the game "Dota 2". Click here for more information.
This article relates to the SDK/Workshop Tools for "Dota 2 Workshop Tools". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Custom Animation Scripts

From Valve Developer Community
Jump to navigation Jump to search

This API allows custom games to use the Valve-authored Dota models while still adding additional custom sequences.

Before a model is loaded (ie. at the beginning of addon_game_mode.lua) you must register a custom animation script:

RegisterCustomAnimationScriptForModel( "models/heroes/medusa/medusa.vmdl", "animation/heroes/medusa/medusa_custom.lua" )

Important Note:The custom script should only be additions you want to make to the original Valve model (ie. don’t include the contents of old Valve .lua animation scripts, only your new sequences.)

An example of such a script is:

-- animation/heroes/medusa/medusa_custom.lua - Add a custom ATTACK2 sequence for Medusa's model
model:CreateSequence(
       {
              name = "attack_q",
              sequences = {
                     { "abil1" }
              },
              activities = {
                     { name = "ACT_DOTA_ATTACK2", weight = 1 }
              }
       }
)