Scripted sequence: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎See Also: Added two links to prefabs and deleted another link which didn't belong.)
m (minoro)
Line 1: Line 1:
{{wrongtitle|title=scripted_sequence}}
{{wrongtitle|title=scripted_sequence}}


==Entity Description==
== Entity description ==
Grabs an NPC and makes them play a specified set of animations. The NPC can be told to move to the scripted sequence position or can be told to play the script wherever they currently are. Multiple scripted sequences of the same name will frame-synchronize in the action animation once all the actors have moved to position. This allows tight interaction between actors (one actor grabbing another, hitting them, etc.) The flow is as follows:
Grabs an [[NPC]] and makes them play a specified set of animations. The NPC can be told to move to the scripted sequence position or can be told to play the script wherever they currently are. Multiple scripted sequences of the same name will frame-synchronize in the action animation once all the actors have moved to position. This allows tight interaction between actors (one actor grabbing another, hitting them, etc.) The flow is as follows:


#Move to position using the specified movement animation. If 'Move to Position' is set to NONE, skip to step 2.
#Move to position using the specified movement animation. If "Move to Position" is set to "None", skip to step 2.
#If forced to wait for another actor to move to position, play the pre-action idle animation, otherwise skip to step 3. If there is no pre-action idle specified, ACT_IDLE is used.
#If forced to wait for another actor to move to position, play the pre-action idle animation, otherwise skip to step 3. If there is no pre-action idle specified, "ACT_IDLE" is used.
#Fire the OnBeginSequence output.
#Fire the "OnBeginSequence" output.
#Play the action animation. If no action animation is specified, skip to step 5.
#Play the action animation. If no action animation is specified, skip to step 5.
#Play the post-action idle animation. If none is specified, skip to step 6. If the 'Loop in Post Idle' spawnflag is set, keep playing the post-action idle until the script is cancelled. If no post-action idle animation is specified, ACT_IDLE is used.
#Play the post-action idle animation. If none is specified, skip to step 6. If the "Loop in Post Idle" spawnflag is set, keep playing the post-action idle until the script is canceled. If no post-action idle animation is specified, "ACT_IDLE" is used.
#Fire the OnEndSequence output.
#Fire the "OnEndSequence" output.
#If a next script to play is specified, hand the NPC to the next script and repeat this process for that script.
#If a next script to play is specified, hand the NPC to the next script and repeat this process for that script.


The MoveToPosition input runs steps 1 and 2, then waits while playing the pre-action idle animation until the BeginSequence input is received.
The "MoveToPosition" input runs steps 1 and 2, then waits while playing the pre-action idle animation until the "BeginSequence" input is received.


==Keyvalues==
== Keyvalues ==
* {{kv targetname}}
* {{kv targetname}}
* {{kv parentname}}
* {{kv parentname}}
Line 20: Line 20:
* {{kv dxlevelchoice}}
* {{kv dxlevelchoice}}
* '''m_iszEntity'''
* '''m_iszEntity'''
: <target_destination> The name or class name (such as 'npc_zombie') of an NPC to use for this script.
: <target_destination> The name or class name (such as "[[npc_zombie]]") of an NPC to use for this script.
* '''m_iszIdle'''
* '''m_iszIdle'''
: <string> The name of the sequence (such as 'idle01') or activity (such as 'ACT_IDLE') to play before the action animation if the NPC must wait for the script to be triggered. Use 'Start on Spawn' flag or MoveToPosition input to play this idle animation.
: <string> The name of the sequence (such as "idle01") or activity (such as 'ACT_IDLE') to play before the action animation if the NPC must wait for the script to be triggered. Use "Start on Spawn" flag or "MoveToPosition" input to play this idle animation.
* '''m_iszPlay'''
* '''m_iszPlay'''
: <string> The name of the main sequence (such as 'reload02') or activity (such as 'ACT_RELOAD') to play.
: <string> The name of the main sequence (such as 'reload02') or activity (such as "ACT_RELOAD") to play.
* '''m_iszPostIdle'''
* '''m_iszPostIdle'''
: <string> The name of the sequence (such as 'idle01') or activity (such as 'ACT_IDLE') to play after the action animation.
: <string> The name of the sequence (such as "idle01") or activity (such as "ACT_IDLE") to play after the action animation.
* '''m_iszCustomMove'''
* '''m_iszCustomMove'''
: <string> Used in conjunction with the 'Custom movement' setting for the 'Move to Position' property, specifies the sequence (such as 'crouch_run01') or activity (such as 'ACT_RUN') to use while moving to the scripted position.
: <string> Used in conjunction with the 'Custom movement' setting for the "Move to Position" property, specifies the sequence (such as 'crouch_run01') or activity (such as "ACT_RUN") to use while moving to the scripted position.
* '''m_flRadius'''
* '''m_flRadius'''
: <float> Radius to search within for an NPC to use. 0 searches everywhere.
: <float> Radius to search within for an NPC to use. 0 searches everywhere.
Line 53: Line 53:
: <target_destination> The name of the script to run immediately after this script completes. The NPC will not return to AI between the two scripts.
: <target_destination> The name of the script to run immediately after this script completes. The NPC will not return to AI between the two scripts.
* '''{{ep1 add|m_iszEntry}}'''
* '''{{ep1 add|m_iszEntry}}'''
: <string> The name of the sequence (such as 'reload02') or activity (such as 'ACT_RELOAD') to play when the sequence starts, before transitioning to play the main action sequence.
: <string> The name of the sequence (such as "reload02") or activity (such as "ACT_RELOAD") to play when the sequence starts, before transitioning to play the main action sequence.
* '''{{ep1 add|m_bLoopActionSequence}}'''
* '''{{ep1 add|m_bLoopActionSequence}}'''
: {{boolean}} Loop Action Animation?
: {{boolean}} Loop Action Animation?
Line 61: Line 61:
: If set, NPC will cancel script and return to AI
: If set, NPC will cancel script and return to AI


==Flags==
== Flags ==
 
* 4 : Repeatable
* 4 : Repeatable


* 8 : Leave Corpse
* 8 : Leave Corpse


* 16 : Start on Spawn - Note: this activates the MoveTo action only. Action Animation will occur only after the scripted_sequence has been otherwise triggered.
* 16 : Start on Spawn - Note: this activates the "MoveTo" action only. Action Animation will occur only after the <code>scripted_sequence</code> has been otherwise triggered.


* 32: No Interruptions
* 32: No Interruptions
Line 79: Line 78:
* 512: Priority Script
* 512: Priority Script


==Inputs==
== Inputs ==
 
* {{i targetname}}
* {{i targetname}}


Line 89: Line 87:


* '''MoveToPosition'''
* '''MoveToPosition'''
: Summons an NPC to the script location. They will play their scripted idle (or ACT_IDLE if none is specified) until BeginSequence is triggered.
: Summons an NPC to the script location. They will play their scripted idle (or "ACT_IDLE" if none is specified) until "BeginSequence" is triggered.


* '''CancelSequence'''
* '''CancelSequence'''
: Stops the scripted sequence. If fired after a sequence starts, this input will not take effect until the NPC finishes playing the scripted action animation.
: Stops the scripted sequence. If fired after a sequence starts, this input will not take effect until the NPC finishes playing the scripted action animation.


==Outputs==
== Outputs ==
 
* {{o targetname}}
* {{o targetname}}


Line 106: Line 103:
* '''OnScriptEvent''(01-08)'''''
* '''OnScriptEvent''(01-08)'''''
: Fires when a 'trigger' anim event occurs while playing the script. Use { event 1003 framenum ''(1-8)'' } in the QC.
: Fires when a 'trigger' anim event occurs while playing the script. Use { event 1003 framenum ''(1-8)'' } in the QC.
==See Also==
 
== See also ==
* The [[npc_zombie_prone]] and [[npc_zombie_slump]] prefabs, providing examples of use.
* The [[npc_zombie_prone]] and [[npc_zombie_slump]] prefabs, providing examples of use.
* [[Activity List]] - A list of activities to use with this entity.
* [[Activity List]] - a list of activities for use with this entity.
* [[aiscripted_schedule]] - A similar entity.
* [[aiscripted_schedule]] - a similar entity.


[[Category:Entities]]
[[Category:Entities]]

Revision as of 13:20, 26 November 2007

Template:Wrongtitle

Entity description

Grabs an NPC and makes them play a specified set of animations. The NPC can be told to move to the scripted sequence position or can be told to play the script wherever they currently are. Multiple scripted sequences of the same name will frame-synchronize in the action animation once all the actors have moved to position. This allows tight interaction between actors (one actor grabbing another, hitting them, etc.) The flow is as follows:

  1. Move to position using the specified movement animation. If "Move to Position" is set to "None", skip to step 2.
  2. If forced to wait for another actor to move to position, play the pre-action idle animation, otherwise skip to step 3. If there is no pre-action idle specified, "ACT_IDLE" is used.
  3. Fire the "OnBeginSequence" output.
  4. Play the action animation. If no action animation is specified, skip to step 5.
  5. Play the post-action idle animation. If none is specified, skip to step 6. If the "Loop in Post Idle" spawnflag is set, keep playing the post-action idle until the script is canceled. If no post-action idle animation is specified, "ACT_IDLE" is used.
  6. Fire the "OnEndSequence" output.
  7. If a next script to play is specified, hand the NPC to the next script and repeat this process for that script.

The "MoveToPosition" input runs steps 1 and 2, then waits while playing the pre-action idle animation until the "BeginSequence" input is received.

Keyvalues

<target_destination> The name or class name (such as "npc_zombie") of an NPC to use for this script.
  • m_iszIdle
<string> The name of the sequence (such as "idle01") or activity (such as 'ACT_IDLE') to play before the action animation if the NPC must wait for the script to be triggered. Use "Start on Spawn" flag or "MoveToPosition" input to play this idle animation.
  • m_iszPlay
<string> The name of the main sequence (such as 'reload02') or activity (such as "ACT_RELOAD") to play.
  • m_iszPostIdle
<string> The name of the sequence (such as "idle01") or activity (such as "ACT_IDLE") to play after the action animation.
  • m_iszCustomMove
<string> Used in conjunction with the 'Custom movement' setting for the "Move to Position" property, specifies the sequence (such as 'crouch_run01') or activity (such as "ACT_RUN") to use while moving to the scripted position.
  • m_flRadius
<float> Radius to search within for an NPC to use. 0 searches everywhere.
  • m_flRepeat
<float> Repeat Rate ms
  • m_fMoveTo
<choices> Move to Position"
Literal Value Description
0 No
1 Walk
2 Run
3 Custom movement
4 Instantaneous
5 No - Turn to Face
  • m_iszNextScript
<target_destination> The name of the script to run immediately after this script completes. The NPC will not return to AI between the two scripts.
<string> The name of the sequence (such as "reload02") or activity (such as "ACT_RELOAD") to play when the sequence starts, before transitioning to play the main action sequence.
<boolean> Loop Action Animation?
<boolean> Synch Post Idles?
If set, NPC will cancel script and return to AI

Flags

  • 4 : Repeatable
  • 8 : Leave Corpse
  • 16 : Start on Spawn - Note: this activates the "MoveTo" action only. Action Animation will occur only after the scripted_sequence has been otherwise triggered.
  • 32: No Interruptions
  • 64: Override AI
  • 128: No Script Movement
  • 256: Loop in Post Idle
  • 512: Priority Script

Inputs

  • BeginSequence
Summons an NPC to act out the scripted sequence.
  • MoveToPosition
Summons an NPC to the script location. They will play their scripted idle (or "ACT_IDLE" if none is specified) until "BeginSequence" is triggered.
  • CancelSequence
Stops the scripted sequence. If fired after a sequence starts, this input will not take effect until the NPC finishes playing the scripted action animation.

Outputs

  • OnBeginSequence
Fires when the action animation begins playing.
  • OnEndSequence
Fires when the action animation completes.
  • OnScriptEvent(01-08)
Fires when a 'trigger' anim event occurs while playing the script. Use { event 1003 framenum (1-8) } in the QC.

See also