It's probably also a smart idea to always check whether something is already animating, before overwriting the start of animations.
Especially true for 3D animations. In fact, that stuff only works reliably when using 'Select' and 'Case' in a separate function I've noticed. Then just feed it the Case it should follow from elsewhere.
ObjectID = LoadObjectWithChildren("mymodel.x") // load model with animations
Do
animate(1,ObjectID) // pass the type of animation you want and object it should affect
Sync()
Loop
Function animate(in, ObjectID)
select in
case 1:
// add code for animation here
if GetObjectIsAnimating(ObjectID) = 0 // check if animation already started
PlayObjectAnimation(ObjectID,"Idle",3,19,1,0) // name and numbers depend on your model animations, but this plays once, finishes and then starts again when GetObjectIsAnimating is false
endif
endcase
endselect
endfunction
You could add extra conditions that will select a different cases in the main Do Loop. Just add the case code and point to it using animate(3,ObjectID) to tell it to go to case 3.