I'd like to chain a series of character animations together into a sequence, playing one after another, perhaps loop one in the middle a couple of times, all while a dialogue track is playing. So far, all I've been able to do is successfully get one animation to loop or play once. Whenever I try to add my own condition like "keyframe [e] =", that doesn't work. I've tried using the "g_Entity[e]['animating'] == 0" flag to detect when the character finishes an animation but that appears to be broken. I've had some success with "g_Entity[e]['frame'] = " but only in so far as I got a prompt to work, I can't seem to call more animation frames. However, I'd rather not use "g_Entity[e]['frame'] = " as a condition as I know it won't work if I chose to loop some of these animations.
Here's what I got so far, but it's a bit messy because I've tried so many different variations.
local shar_keyframe = {}
function shar_monologue_init(e)
shar_keyframe[e] = 1
end
function shar_monologue_main(e)
if shar_keyframe[e] == 1 and g_Entity[e]['animating'] == 0 then
PlaySound(e,1)
SetAnimationFrames(3110,3420)
PlayAnimation(e)
SetAnimationSpeed(e,0.75)
shar_keyframe[e] = 2
elseif g_Entity[e]['frame'] >= 3420 then
StopAnimation(e)
shar_keyframe[e] = 3
end
if shar_keyframe[e] == 3 then
SetAnimationFrames(4470,4535)
PlayAnimation(e)
SetAnimationSpeed(e,1)
shar_keyframe[e] = 4
Prompt ("???")
end
end
This will call the animation once and then the prompt, but not the second animation.
AE