scripted_sequence
Jump to navigation
Jump to search
Code classes:
CAI_ScriptedSequence
CBaseEntity
(all ents)
scripted_sequence
is a point entity present in all games except the Left 4 Dead games. Grabs an NPC and makes them play a specified set of animations. Multiple scripted_sequence
s of the same name will 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 order of events is as follows:
- MoveToPosition or BeginSequence input is sent.
- Move into position (or don't) however Move to Position says to. The NPC will face in the direction of Pitch Yaw Roll.
- If forced to wait for another actor to move to position, play the Pre Action Idle Animation. If there is none specified,
ACT_IDLE
is used. Skipped if the BeginSequence input is sent. - BeginSequence input is sent now, if it wasn't already.
- Play the Entry Animation, if specified.
- Play the Action Animation, if specified.
- Play the Post Action Idle Animation once, or indefinitely if the Loop in Post Idle spawnflag is set (animation can be stopped with the CancelSequence input). If there is none specified,
ACT_IDLE
is used. - If there's a Next Script to play, hand the NPC off to that one and run through the steps again.
Tip: Sequences and activities can be viewed in Hammer's model browser.
Bug: Known to cause npc_antlion
s to be stuck in their flying animation.
Flags[edit | edit source]
- 4: Repeatable - Sequence is allowed to be repeated. Otherwise, the entity removes itself after it's no longer serving any purpose.
- 8:
Leave Corpse- Does nothing.
- 16: Start on Spawn - Emulates sending the MoveToPosition input when this entity spawns.
- 32: No Interruptions - Disallows the NPC from being interrupted by damage from enemies.
- 64: Override AI - To do: Purpose.
- 128:
Don't Teleport NPC On End- Does nothing.
- 256: Loop in Post Idle - Loop the Post Action Idle Animation indefinitely.
- 512: Priority Script - To do: Purpose.
- 4096: Allow actor death - Lets the script continue even if an actor dies. Used for scripted deaths.
Keyvalues[edit | edit source]
- Target NPC
(m_iszEntity)
<target_destination>
- Targetname or classname of an NPC to control. If the entity finds multiple NPCs to control, it picks whichever has the lowest index value.
- Search Radius
(m_flRadius)
<float>
- Target NPCs must be this close to the
scripted_sequence
entity. - Move to Position
(m_fMoveTo)
<choices>
- How the Target NPC should move to the position of the
scripted_sequence
.- 0: No - MoveToPosition input does nothing, NPC does animations wherever it currently is when BeginSequence is sent.
- 1: Walk
- 2: Run
- 3: Custom movement - Uses a custom animation set by Custom Move Animation.
- 4: Instantaneous - NPC teleports.
- 5: No, Turn to Face
- Custom Move Animation
(m_iszCustomMove)
<string>
- Name of a sequence or activity which the NPC will play as it moves to the
scripted_sequence
. - Note: Seems to only accept "movement" type animations; others cause the NPC to teleport to the goal. To do: Exactly how does it know the difference?
- Bug: When moving via the MoveToPosition input, the NPC will continue doing this animation after they've reached the goal.
- Pre Action Idle Animation
(m_iszIdle)
<string>
- Sequence or activity which plays before Entry Animation. NPC holds the last frame of this animation once it finishes.
- Entry Animation
(m_iszEntry)
<string>
- Sequence or activity which plays before Action Animation.
- Action Animation
(m_iszPlay)
<string>
- Sequence or activity which is the "main" animation.
- Loop Action Animation?
(m_bLoopActionSequence)
<boolean>
- Loops the Action Animation.
- Note: The animation used must be one that's actually intended to loop. To do: Figure out exactly how that's determined.
- Post Action Idle Animation
(m_iszPostIdle)
<string>
- Sequence or activity which plays after Action Animation, or forever if Loop in Post Idle is checked.
- Bug: Sometimes this animation plays twice, even if the flag is not checked.
- Sync Post Idles?
(m_bSynchPostIdles)
<boolean>
- Should NPCs in
scripted_sequence
s of the same name sync their Post Action Idle Animations? - Next Script
(m_iszNextScript)
<target_destination>
- Name of a
scripted_sequence
to run after this one completes. Repeat Rate ms(m_flRepeat)
<float>
- Does nothing.
- Ignore Gravity on NPC during script
(m_bIgnoreGravity)
<boolean>
- Allows the NPC to fly while affected by the script. To do: Why?
- Disable NPC collisions during script
(m_bDisableNPCCollisions)
<boolean>
- Disables collisions with other NPCs in
scripted_sequence
s of the same name which also have this option set to Yes. To do: Why? - On player death
(onplayerdeath)
<choices>
- What to do if the player dies.
- 0: Do Nothing
- 1: Cancel Script and return to AI
Inputs[edit | edit source]
- MoveToPosition
- Makes an NPC move to this entity.
- BeginSequence
- Makes an NPC move to this entity and begins the sequence.
- CancelSequence
- Takes the NPC out of the script.
- ScriptPlayerDeath (Not in FGD)
- Pretends that the player died.
Outputs[edit | edit source]
- OnBeginSequence
- Fires when the Action Animation begins playing, or when the Entry Animation does if there is one.
- OnPostIdleEndSequence (Not in FGD)
- Fires every time the Post Action Idle Animation plays.
- OnEndSequence
- Fires when all the animations before Post Action Idle Animation have finished.
- OnCancelSequence
- Fires when all the animations have finished.
- OnCancelFailedSequence
- Fires when the script is interrupted at any stage by other AI, or when CancelSequence is sent (even if it hasn't started yet).
- OnScriptEvent01 to OnScriptEvent08
- Fires when an associated animation event happens. Use
{ event 1003 framenum 1-8 }
in the QC.