• Register

I run English support for the Visionaire Studio game engine. I also provide the documentation for the engine as well as various tutorials & Lua scripts. I also provide development & scripting services/support for games being developed in Visionaire Studio. I am also quite proficient at planning & coming up with workaround solutions to various problems &/or limitations. Aside from the Visionaire Stuff I've mentioned above: I've been known to dabble with music production & web design over the years. I even ran a music production forum & indie record label for a few years. I have hypothetical insomnia & I have a strong dislike of modern shorthand English mobile texting; what's wrong with typing out English the way it's supposed to be written? </profile></rant></end>

Post tutorial Report RSS Dynamic Character Blink (on idle)

A few days ago (or so) the dev lead asked me to add dynamic blinking to the main character for the idle character animations. He wanted the character to blink at random intervals instead of at the end of each idle animation loop cycle. The solution ended up being pretty simple...

Posted by on - Basic Client Side Coding


First I started off by attaching the blink animation to the end of each of the idle animations & then I edited the first frame of each of the idle animations & created an execute a script action part containing...

if math.random(20) < 13 then
 ActiveAnimations["animation_name"].AnimationLastFrame = 16
else
 ActiveAnimations["animation_name"].AnimationLastFrame = 21
end

"animation_name" would be the name of the animation (I added a generic name to the code block). Also the number values are the amount of frames of the animation without & with the blink part of the animation. In this case frames 1-16 were the idle part of the animation & frames 17-21 was the blink part.

The little script above randomly generates a number between 1 & 20 & if the number is less than 13 then it will only play the idle part of the animation but if it equals 13 or more then it will play the idle part of the animation & then the blink part of the animation. This means that there is a 7 out of 20 chance that the character will blink at the end of the idle animations loop cycle.

In Visionaire Studio we can force which animation frames of an animation can be played by defining the initial & end frame using AnimationFirstFrame & AnimationLastFrame.

Pretty straightforward, no?

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: