PivityGmodStore

Creating custom animations

The Perfect Hands animation works by changing the angles of the players' bones.

To create a custom animations, you will need to know exact angles of the bones and bone names.



Example of the animation definition:

P.animations.Add("surrender", {

    ["ValveBiped.Bip01_L_Forearm"] = Angle(25, -65, 25),

    ["ValveBiped.Bip01_R_Forearm"] = Angle(-25, -65, -25),

    ["ValveBiped.Bip01_L_UpperArm"] = Angle(-70, -180, 70),

    ["ValveBiped.Bip01_R_UpperArm"] = Angle(70, -180, -70)

})

Explanation:

  1. Where surrender — this is animation ID, this value should be unique across all animations, since it is used to identify what bones to move.
  2. Where ValveBiped.Bip01_L_Forearm/ValveBiped.Bip01_R_Forearm/ValveBiped.Bip01_L_UpperArm/etc. — this is bone names, basically a unique bone ID. List of all default bones can be found here.
  3. Where Angle(25, -65, 25)/Angle(-25, -65, -25)/Angle(-70, -180, 70)/etc. — this is desired angle that should be applied to a bone. More about angle structure.

All default animations can be found in lua/mvp/packages/perfecthands/sh_animations_list.lua file.



To create your custom animation, you'll need to place animation definition in the lua/mvp/packages/perfecthands/sh_animations_list.lua file, following the example above.



As you can see, in the above examples there is no explicit mention of the animation name or description. This is because all language-dependent parameters are handled by the language system. To define name and description, navigate to lua/mvp/packages/perfecthands/languages/[your language].lua file. There are a number of strings, we're looking for the block of strings that contain phands.animation as its prefixes.

Example of the animation name and description in language system:

l["phands.animation.surrender"] = "Surrender"

l["phands.animation.surrender.description"] = "You raise your hands and accept your fate."

Explanation:

  1. Where phands.animation.surrender — a language key, tied to a specific animation, representing name of said animation.
  2. Where phands.animation.surrender.description — a language key, tied to a specific animation, representing description of said animation.

Keys are formed following this format:

For the name: phands.animation.[animation id]

For the description: phands.animation.[animation id].description

  1. phands.animation. — always a static part.
  2. [animation id] — your unique animation ID.



To add a name and a description to your custom animation, you'll need to place language definitions in the lua/mvp/packages/perfecthands/languages/[your language].lua file, following the example above.



If you have any questions about adding your custom animations to Perfect Hands, do not hesitate to open a support ticket.

Can't find what you're looking for?

Contact support