Jump to content

Is there a way to control the animation speed of an object by scripting?


ghozt24

Recommended Posts

Hello!

As the title states, I need to know if there's a way to control the animation speed of objects, such as vault doors or fans, by scripting.

I know I can obtain it by editing the model's frequency parameter on NifSkope but I'm interested about an alternative way working on CK.

Link to comment
Share on other sites

Yes, you can use SetAnimVariableFloat to control the speed of animations. Unfortunately the actual variables are not documented. Look in the water fountain drinking script (whatever it is called) for examples of how they speed up and slow down the water animation. The variable is called something weird like toggleblend something something whatever.

Link to comment
Share on other sites

Ok, the exact commands for the water fountain are:

 

SetAnimationVariableFloat("fDampRate", 0.08) ; sets the animation speed (larger number is faster, but only need to make very small changes)
SetAnimationVariableFloat("fToggleBlend", 1.0) ; 1.0 turns on animation, 0.0 turns it off

Different objects use different variables. You can use a program like Agent Ransack to search all scripts for "SetAnimationVariable" to see which objects use which variables.

Link to comment
Share on other sites

Thank you, seems Agent Ransack is a very powerful tool! I have never used before.

Actually, I'm looking for a way to control the rotation speed of FO4 windmill. After having explored some animation stuff via Agent Ransack, it seems lots of animated objects manage its animation speed by one variable named "fSpeed". However, the windmill doesn't react if I attach a script and I vary "fSpeed" (or "fToggleBlend") inside of it. I also tried to work with other functions, such as "ApplyFanMotor" and "FanMotorOn" but, here too, I have no results (maybe because the objects which use those functions, such as the desktop fan and the mirrorball, have a nif node architecture that is different than the windmill's one). Any suggestion to reach my purpose?

Link to comment
Share on other sites

See if there is a hkx file associated with the windmill animation somewhere. Most nifs that use animations inherit some sort of Havok Behavior template. It's defined in one of the main blocks in the nif file, and points to the hkx files in the animations archive. If you find the relevant file, try decompiling it with HKXPack (https://github.com/Dexesttp/hkxpack) and see what variables are used.

 

I was looking at this thread where all the animation variables for Skyrim were posted, and the OP basically had extracted them from the 0_Master.hkx file, but Fallout 4 has them all spread out in separate files afaik.

 

Cheers

Link to comment
Share on other sites

Hi , I've just had a quick look at one of the raider windmills, they use baked-in gamebryo animation and don't use any of the GenericBehavior hkx files, so the only way to control the speed is to edit the nif itself.

I suppose to give the illusion of speed control, you could use a script to place a custom (disabled) windmill over an existing windmill, then disable the existing mill while simultaneously enabling the custom windmill, etc.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...