Difference between revisions of "SetAnimFrames (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "{| class="wikitable" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | setAnimFrames("ani", n1, n2)...")
 
Line 10: Line 10:
 
== Instructions ==
 
== Instructions ==
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
2. To use this function you should create an execute a script action containing...
+
2. To use this function you should create an ''execute a script'' action containing...
 
<syntaxhighlight>
 
<syntaxhighlight>
 
setAnimFrames("animation_name", 1, 1) -- set active animation animation_name's first frame to 1 & last frame to 1
 
setAnimFrames("animation_name", 1, 1) -- set active animation animation_name's first frame to 1 & last frame to 1

Revision as of 20:15, 14 August 2014

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