This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
--[[
Item Animation Control (v2) [very short method]
Written by AFRLme
-- * --
label@alternatingfrequencies.com | aim, skype, trillian @ AFRLme
--]]
-- * let's create the function which sets the static frame for all items currently in the characters inventory * --
function initItems()
tblItmFrm = {} -- creates an empty table
tblItmFrm["_temporary_"] = "" -- sets table to temporary
tblItmFrm["items"] = game:getLink(VGameCurrentCharacter):getLinks(VCharacterItems) -- stores character items
-- * --
if table.maxn(tblItmFrm["items"]) > 0 then -- if items table is not empty then do ...
for i = 1, table.maxn(tblItmFrm["items"]) do -- for i = 1 to total number of items do ...
tblItmFrm["act_anim"] = getObject("ActiveAnimations[" .. tblItmFrm["items"][i]:getName() .. "]") -- store active animation
tblItmFrm["gen_anim"] = getObject("Animations[" .. tblItmFrm["items"][i]:getName() .. "]") -- store general animation
tblItmFrm["frames"] = tblItmFrm["gen_anim"]:getSprites(VAnimationSprites) -- store frames
tblItmFrm["frames"] = table.maxn(tblItmFrm["frames"]) -- convert total of frames into an integer value
-- * --
--print("item: " .. tblItmFrm["items"][i]:getName() .. ", frames: " .. tblItmFrm["frames"]) -- prints item name & frame amount to log
tblItmFrm["act_anim"]:setValue(VAnimationFirstFrame, tblItmFrm["frames"]) -- sets item animation to last frame & stops it from looping
end
end
end
initItems()getObject("ActiveAnimations[add item name here]"):setValue(VAnimationFirstFrame, add last frame number)
-- example
getObject("ActiveAnimations[1_Weapon]"):setValue(VAnimationFirstFrame, 4)