SetAnimFrames (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 18:21, 19 August 2014 by David Stoffel (talk) (Text replacement - "wikitable" to "ts")
Name Type By
setAnimFrames("ani", n1, n2) Definition AFRLme

This small function allows you to quickly set the first & last frame of an active animation.

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. To use this function you should create an execute a script action containing...

setAnimFrames("animation_name", 1, 1) -- set active animation animation_name's first frame to 1 & last frame to 1

Main Script

function setAnimFrames(ani, n1, n2)
 getObject("ActiveAnimations[" .. ani .. "]"):setValue(VAnimationFirstFrame, n1)
 getObject("ActiveAnimations[" .. ani .. "]"):setValue(VAnimationLastFrame, n2)
end


Syntax Breakdown

Name Type Description
ani "string" This should be a "string" value containing the name of the animation you want to affect.
n1 integer This should be an integer (number) value which will determine which frame will be the initial (from) frame of the linked animation (ani).
n2 integer This should be an integer (number) value which will determine which frame will be the final (to) frame of the linked animation (ani).