Scripted sequence

It is used to make an NPC play scripted animations.
A scripted_sequence typically takes a Target NPC which can be set to either move to the sequence's position or play the sequence's animation at the NPC's current position. When the NPC is ready to begin the sequence, it will play the specified animation(s) in a special scripted state which may or may not be interrupted depending on the scripted_sequence's settings.
__TOC__
== Script flow ==
Whenever a scripted_sequence plays with a valid Target NPC, it uses a special flow to make the NPC play its animations in specific, coordinated ways:
# Unless the "Start on Spawn" flag ticked, the scripted_sequence remains inert until it is triggered. It will remain inert until the BeginSequence input is received or it is used by a previous scripted_sequence.
# Upon being triggered, the scripted_sequence will look for the nearest NPC specified in "Target NPC".
# When a NPC is found, it will either move to the scripted_sequence's position or begin standing still depending on the "Move to Position" setting.
# When the NPC reaches the scripted_sequence, it will play the "Pre-Action Idle Animation" if it is set to wait (see below). It will play the animation until all conditions are satisfied. If the script is not set to wait for anything, it will skip this step.
# The scripted_sequence fires its OnBeginSequence output.
# If the scripted_sequence has an Entry Animation, the NPC will play it. If the script does not have an entry animation, it will skip this step.
# The NPC plays the Action Animation. If no action animation is specified in the script, it will skip this step.
# If the scripted_sequence has a Post-Action Idle Animation, the NPC will play it. If no post-action idle animation is specified in the script, it will skip this step. If the "Loop in Post Idle" spawnflag is set, the NPC will continue to play the post-action idle animation until the script is canceled.
# The scripted_sequence fires its OnEndSequence output.
# If the scripted_sequence has a Next Script, the NPC is handed to the target script and this process is repeated automatically. If not, the NPC returns to regular behavior.
There are a few external factors which can modify this flow:
* If the sequence was triggered by the "Start on Spawn" flag or the MoveToPosition input, the NPC will play the Pre-Action Idle Animation until the BeginSequence input was received. If BeginSequence was used to begin with, it will proceed as normal.
* If the sequence shares its name with other sequences, it will wait for other NPCs to get into position before starting, playing the Pre-Action Idle Animation until all actors are in position. When the script has no remaining dependencies, it will proceed as normal.
* If the Target NPC was asleep (via "Sleep State" or Sleep) when it was grabbed, it will awaken automatically without firing OnWake.
* If the Pre-Idle Idle Animation is the same as the Action Animation, the pre-action idle animation will freeze on its first frame, waiting for the script to start to play the full animation. 
== Keyvalues ==
:
Literal Value	Description
0 	No
1 	Walk
2 	Run
3 	Custom movement
4 	Instantaneous
5 	No - Turn to Face
== Flags ==
== Inputs ==
== Outputs ==
== Locating animations ==
You can use the model tab in the entity window.
Or
You can use the Half-life Model Viewer tool to see all the available sequences(Animations) for the model you're using.
You can find the application in the Source SDK.
When you've launched the tool go to File and load the model you want. Then go to the Sequence tab and select an animation from the dropdown menu to get the model you've select to play that animation or sequence.
What it looks like:
== See also ==
* The npc_zombie_prone and npc_zombie_slump prefabs, providing examples of use.
* Activity List - a list of activities for use with this entity.
* aiscripted_schedule - a similar entity.
* falling headcrab tutorial - A tutorial for how to make a headcrab fall, using this entity.
* Actbusy - An alternative to scripted_sequence which doesn't involve setting a NPC in a scripted state.
Category:Entities