Difference between revisions of "Dota 2 Workshop Tools/Custom Animation Scripts"

From Valve Developer Community
Jump to: navigation, search
(Created page with "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_ga...")
 
(Added category to the page, added shortpagetitle template)
Line 24: Line 24:
 
)
 
)
 
</pre>
 
</pre>
 +
 +
{{shortpagetitle}}
 +
[[Category: Dota 2 Workshop Tools]]

Revision as of 11:09, 16 June 2019

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 }
              }
       }
)