Here's a script that gives you an idea of how to do this:
(script startup bruteram
(sleep_until (volume_test_objects bruteattack (players)) 1)
(object_create brute)
(object_create marine)
(custom_animation brute "characters\brute\bruteram" "stand brute ram" 1)
(sleep_until (<= (unit_get_custom_animation_time brute) 8) 1)
(unit_kill marine)
(sleep_until (= (unit_is_playing_custom_animation brute) 0) 1)
(ai_attach brute brutes)
)
You can replace everything with what you're using. I used "brute" as the name for brute, "marine" for name of the marine, "characters\brute\bruteram" is your animation tag, "stand brute ram" is the name of the animation within the animation tag, and "brutes" is the AI encounter.
Basically, the marine and brute are created, and the custom animation is run on the brute. Then, it sleeps until a certain number of frames are left in the animation with (unit_get_custom_animation_time). This is the exact frame when the brute rams the marine and is supposed to kill him, which happens right after with (unit_kill). You'll have to change the number in bold up there to the number of frames left to get the timing right, I just picked a random number. Then, it waits until the animation is finished, and then attaches AI to the brute.
To explain the "custom_animation" command:
(custom_animation "unit" "animation_graph" "string" "boolean")
starts a custom animation playing on a unit (interpolates into animation if last parameter is TRUE)
"unit" is the name of the biped or vehicle (usually biped). "animation_graph" is just the path to the animation tag. "string" is the name of the exact animation from that animation tag to run. "boolean" is explained above: it smoothly moves into the animation if it's set to true, so I set it to true.
Edited by Me KS on Mar 9, 2009 at 10:35 PM