This article relates to the game "Dota 2". Click here for more information.
This article relates to the workshop tools for "Dota 2". 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
< Dota 2 Workshop Tools
Revision as of 01:34, 16 May 2020 by Deprecated (talk | contribs) (Added top icons)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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 }
              }
       }
)