Scripted sequence: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (fixed "Taget NPC")
Line 23: Line 23:
{{KV DXLevelChoice}}
{{KV DXLevelChoice}}


{{KV|Taget NPC|target_destination|The name or class name (such as 'npc_zombie') of an NPC to use for this script.}}
{{KV|Target NPC|target_destination|The name or class name (such as 'npc_zombie') of an NPC to use for this script.}}


{{KV|Pre Action 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.}}
{{KV|Pre Action 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.}}

Revision as of 14:35, 12 September 2017

Template:Hl2 point

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

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities


Parentname:
Parent (parentname) <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.


Pitch Yaw Roll (Y Z X) (angles) <QAngle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.


Minimum / Maximum DX Level (mindxlevel / maxdxlevel) <integer choices> (removed since Left 4 Dead)
The entity will not exist if the engine is running outside the given range of DirectX Versions.
Choices
Warning.pngWarning:If these are used, the object may break when the user switches their DirectX settings.[missing string]


Target NPC ([todo internal name (i)]) <targetname>
The name or class name (such as 'npc_zombie') of an NPC to use for this script.


Pre Action Idle Animation ([todo internal name (i)]) <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.


Entry Animation ([todo internal name (i)]) <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.


Action Animation ([todo internal name (i)]) <string>
The name of the main sequence (such as 'reload02') or activity (such as 'ACT_RELOAD') to play.


Post Action Idle Animation ([todo internal name (i)]) <string>
The name of the sequence (such as 'idle01') or activity (such as 'ACT_IDLE') to play after the action animation.


Custom Move Animation ([todo internal name (i)]) <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.


Loop Action Animation? ([todo internal name (i)]) <boolean>
Repeat permamently "Action animation"? See "Action Animation."


Synch Post Idles ([todo internal name (i)]) <boolean>


Search Radius ([todo internal name (i)]) <radius>
Radius to search within for an NPC to use. 0 searches everywhere.


Repeat Rate ms ([todo internal name (i)]) <boolean>
How long NPC will repeat "Action Animation". See "Action Animation". Useless with "Loop Action Animation?"


Move to Position ([todo internal name (i)]) <choices>
How the NPC will walk to this scripted_sequence.
Literal Value Description
0 No
1 Walk
2 Run
3 Custom movement
4 Instantaneous
5 No - Turn to Face


Next Script ([todo internal name (i)]) <targetname>
The name of the script to run immediately after this script completes. The NPC will not return to AI between the two scripts.


Ignore Gravity on NPC during Script ([todo internal name (i)]) <boolean>
If this is set to 'Yes', the NPC will not be subject to gravity while playing this script


Disable NPC collisions during Script ([todo internal name (i)]) <boolean>
Useful for when NPCs playing scripts must interpenetrate while riding on trains, elevators, etc. This only disables collisions between the NPCs in the script and must be enabled on BOTH scripted_sequences.


On Player death ([todo internal name (i)]) <boolean>
If set, NPC will cancel script and return to AI.

Flags

  • 4 : Repeatable
  • 8 : Leave Corpse (Forces NPC corpse to remain rather than fade out)
  • 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 (NPC sequence isn't allowed to be interrupted)
  • 64: Override AI (NPC will be overridden regardless of current state)
  • 128: Don't Teleport NPC at End (Don't fixup end position with a teleport when the SS is finished)
  • 256: Loop in Post Idle (Loop in the post idle animation after playing the action animation)
  • 512: Priority Script (Stops other scripts from stealing spot in queue)
  • 1024 : Search Cyclically (Start search from last entity found)
  • 2048 : No Complaints (Skip developer warnings)
  • 4096 : Allow NPC Death (The NPC using this scripted sequence may die without interrupting the scene (used for scripted deaths))

Inputs

Parentname:
SetParent <stringRedirectInput/string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <stringRedirectInput/string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset <stringRedirectInput/string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.


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.

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: Hlmw.jpg

See also