This article's documentation is for anything that uses the Source engine. Click here for more information.

$declaresequence

From Valve Developer Community
Jump to: navigation, search

$declaresequence is a QC command available in all Source Source games. It forward declares a sequence.

This is useful when you want to add other sequences as layers that aren't locally declared, such as when they're actually part of an external .mdl file (see $includemodel). $declaresequence makes a empty sequence entry so that the local sequence pointers can get set, and at run time these references are overwritten with the actual sequence index.

In simple man's terms: $declaresequence can be used to tell the compiler that the declared sequences are to be taken from the $includemodel, but the ones not declared will be taken from the current compile. Useful to prevent sequence index mismatches if modding for multiplayer by changing the order of declared sequences.
Declared sequences will be compiled in the order the $declaresequence lines appear, not in the order of the original $includemodel file. If you do want to keep the sequence order of the $includemodel without making any changes, you do not need $declaresequence.

Warning.pngWarning:Should you use two $includemodel.mdl's that have sequences of the same name, $declaresequence will not differentiate between which of the mdl's animation is declared and ends up declaring both, with the same name.
Where usually a "Duplicate sequence" error would pop up, if $sequence is used, using declaresequence does not produce this error on compile, but the results may be visible in the game.

Syntax

 $declaresequence (sequence name)

Example

If you want to replace one animation of a model while using all others from the $includemodel you will need to create a DeclareSequence.qci file listing all animations. Crowbar is capable of making one for you.
Then simply comment out your desired declare sequence and add a $sequence in its stead.

...
$declaresequence "melee_sweep_FirstAidKit"
$declaresequence "use_cola"
$declaresequence "melee_sweep_cola"

//$declaresequence "use_ammopack"
$sequence "use_ammopack" "anims/use_ammopack_NEW" fadein 0.2 fadeout 0.2 fps 30

$declaresequence "crouch_use_ammopack"
$declaresequence "melee_sweep_ammopack"
$declaresequence "Defibrillate_Incap_Standing"
...

Of course you will need to add the declaresequence.qci file and the $includemodel to your compiling QC file using the $includemodel and $include commands

//includemodel of the original anim_teenangst.mdl to take animations from
$includemodel "survivors/animaTeenAngst.mdl"
//declaresequence to copy all animations but replace one (or multiple)
$include "anim_teenangst_DeclareSequence.qci"