Call of Duty 5: Body Animation
For a list of animations you can use visit the List of Animations page.
We will go over how to implement body animations and what you can do with animation system in regards to body animations and mixing it in with dialog.
Set Up
For basic instructions on how to set up your animation (AI and GSC script), visit the Animation Overview page.
In a nut shell, you will need to assign your AI an animName in script and have your animation set up.
For the remainder of this page, we will assume:
- You've included maps\_anim at the top of your GSC
- Our AI is stored in a variable level.sarge
- Our AI has an animName of "sarge"
- Our animation reference name is "meet_by_wall"
- Our animation refers to an animation "Ch_oki3_regroup_sarge_order"
AI Animating
anim_single_solo is the script call we will be using for our animation. The naming convention of the function is specifically why we chose it:
Name | Meaning |
---|---|
anim | Animation. |
single | Animation plays only once. |
solo | Animation played by one single AI. |
The function parameters for anim_single_solo are (in respective order):
Parameter | Mandatory | Description |
---|---|---|
<guy> | Yes | Guy that animates. |
<anime> | Yes | Animation scene. |
<tag> | No | A tag to animate relative to. |
<entity> | No | Overwrite the scene base. |
<tag_entity> | No | Overwrite the base for the tag. |
At the very minimum we will need to pass a guy and animation through to the function:
level.sarge thread anim_single_solo( level.sarge, "meet_by_wall" );
That line will have your AI play a generic lip syncing animation while speaking where ever he is standing when that line is called.
Animating at a specific Location
You can change where on the map an AI will play an animation by calling the animation function on the location rather than on the AI.
anim_node = getStruct( "location_for_animation", "targetname" ); // Get the script_struct (location for animation) anim_node thread anim_single_solo( level.sarge, "meet_by_wall" ); // Call the anim function on the variable that has our script_struct
Multiple AI Animating
There are a couple ways you can go about accomplishing this, we will cover a few methods.
For our second AI we will assume:
- Our second AI is stored in a variable level.polansky
- Our second AI has an animName of "polansky"
- Our second animation reference name is "shadows"
- Our second animation refers to a sound alias "Oki3_IGD_242A_POLO"
Non-Threading
The simplest of the methods is to not thread our animation. Threading our functions stems to the called function but the parent function that made the call continues to keep progressing.
Threading | level.sarge thread anim_single_solo( level.sarge, "meet_by_wall" ); |
Non-Threading | level.sarge anim_single_solo( level.sarge, "meet_by_wall" ); |
With that, we can now make two converse:
#include maps\_anim; #include maps\_utility; #include common_scripts\utility; main() { maps\_load::main(); level.sarge anim_single_solo( level.sarge, "meet_by_wall" ); // First dialog animation level.polansky anim_single_solo( level.polansky, "whispers" ); // Second dialog animation }
Wait for Notify
Another way of simulating AI conversing would be to wait for a notify from the animation.
Every time we play an animation that isn't looping, there is a notification sent out when it is done playing. The notification is "single anim".
#include maps\_anim; #include maps\_utility; #include common_scripts\utility; main() { maps\_load::main(); level.sarge thread anim_single_solo( level.sarge, "meet_by_wall" ); // First dialog animation level.sarge waittillend( "single anim" ); // Waittill level.sarge finishes his animation level.polansky thread anim_single_solo( level.polansky, "whispers" ); // Second dialog animation }
Wait Time
Another way of simulating AI conversing would be to wait a defined amount of seconds between each animation.
#include maps\_anim; #include maps\_utility; #include common_scripts\utility; main() { maps\_load::main(); level.sarge thread anim_single_solo( level.sarge, "meet_by_wall" ); // First dialog animation wait 3 ; // Wait 3 seconds level.polansky thread anim_single_solo( level.polansky, "whispers" ); // Second dialog animation }