I think a better solution here would be to do different torso animations in MED. Why complicated scripting when you can achieve the same without scripting?