解释下QC
1.$body
格式是$body "a" "b"
这个命令就是指定主模型的。
b就是指定的身体,例如我们的主模型是leet.smd,那b就是leet,a貌似能任意改。
单个smd的三角面**是4000面左右,2100顶点左右,假如指定多个$body就能使cs模型超越4000面。
比如:
$body "studio" "leet1"
$body "studio" "leet2"
$body "studio" "leet3"
编译出来的效果是leet1.smd,leet2.smd,leet3.smd主模型的合成,其中leet1.smd,leet2.smd,leet3.smd是主模型,他们的骨骼要求是同一个骨骼。每个smd的**是4000面,那3个smd理论上最多能到12000面,所以就超过了4000面的**了。
具体能用多少个$body,引擎能接受多少面还没测试过。
2.$bodygroup
这个是指定附件的,cs中的c4或者钳子就是这样做的。
格式是$bodygroup "a"
例如T的C4:
$bodygroup "backpack"
{blankstudio "bomb"}
这里指定了两个studio,第一个是blank,第二个是"bomb"也就是bomb.smd。
通常情况显示的是第一个studio,也就是空的studio,当你有了C4,就显示第二个studio("bomb"),死了以后就回到第一个studio。
3.$texturegroup skinfamilies
给一个模型指定多张贴图。我做的**人质就是用的这个命令。
格式:
$texturegroup skinfamilies
{
{ "a1.bmp" "a2.bmp" "a3.bmp" }
{ "b1.bmp" "b2.bmp" "b3.bmp" }
}
编译后会出现两套skin。
第二套skin会用 "b1.bmp" "b2.bmp" "b3.bmp" 替换掉"a1.bmp" "a2.bmp" "a3.bmp" 。
但貌似这个方法对CS角色模型不起作用,游戏中只会显示第一套皮肤,对人质模型是起作用的。
4.场景动作($sequence)
场景动作。
根据sdk的解释:
格式:$sequence “sequence name” “smd file”
“Sequence name” is a text name for the sequence。
“Smd file” is the name of the smd file which supplies the keyframes for this sequence (without the .smd suffix). It’s a good idea to enclose this in quotes as well.
可以看出“Sequence name”是场景动作的名称, “smd file”是“Sequence name”包含的具有关键帧的smd场景动作。
比如:$sequence "dummy" "dummy"
dummy这个场景动作包含dummy.smd。
比如:$sequence "crouch_aim_carbine" {
"crouch_aim_carbine_blend1"
"crouch_aim_carbine_blend2"
"crouch_aim_carbine_blend3"
"crouch_aim_carbine_blend4"
"crouch_aim_carbine_blend5"
"crouch_aim_carbine_blend6"
"crouch_aim_carbine_blend7"
"crouch_aim_carbine_blend8"
"crouch_aim_carbine_blend9"
crouch_aim_carbine这个场景动作包含crouch_aim_carbine_blend1.smd-crouch_aim_carbine_blend9.smd这9个smd动作。
5.动作提取(LX)
$sequence “sequence name” “smd file” fps 30 LX loop ACT_WALK 1
根据sdk解释:
LX means that this animation uses “motion extraction” – meaning the movement portion of the animation will be passed on to the AI or the player movement to be evaluated. LX allows you to set up walk or run cycles which in which the poses repeat but the movement is varied by the AI or player control.
LX说明这个动画使用了"运动提取",意味着这个动画的运动部分将传递给AI引擎或者玩家的运动控制。LX允许你建立walk或者run的完整动作,在这个动作中,姿势是重复的但是运动受AI或者玩家不同的控制。
也就是说使用了LX后引擎和玩家决定了模型运动的方向,速度,轨迹等。而smd只是决定了模型的姿势,fps决定它的播放速率。
Movement animations use the LX motion extraction parameter as part of their $sequence line. LX enables the engine to keep track of the model’s position and prevents the model from snapping back to its initial position after each play-through of the cycle. If you forget to add the LX tag to your sequence, the model will continually pop back to its starting point rather than navigating through the world.
动作使用LX运动提取参数是$sequence的一部分。LX能使引擎保持模型位置的轨迹并且在每次播放完整动作后阻止模型恢复最初位置。
经过测试证明,删除LX后在hlmv中察看的效果是模型的位置不固定了,比如run,有LX的时候模型会持续的在一个位置跑动,但是删除了LX后模型会持续的向前跑,等播放完一个完整的动作后又回到原来的位置继续向前跑。。。删除LX后是进不了游戏的。
估计LX就是**模型在X方向上移动,它的移动由引擎和玩家控制。因为下半身的朝向就是运动的方向,这个方向就是X。
另外发现其他模型中还有AX的写法,不明白什么意思。
6.动作合成(blend)
$sequence "crouch_aim_carbine" {
"crouch_aim_carbine_blend1"
"crouch_aim_carbine_blend2"
"crouch_aim_carbine_blend3"
"crouch_aim_carbine_blend4"
"crouch_aim_carbine_blend5"
"crouch_aim_carbine_blend6"
"crouch_aim_carbine_blend7"
"crouch_aim_carbine_blend8"
"crouch_aim_carbine_blend9"
blend XR -90 90 fps 30 loop
}
在这里注意blend XR -90 90,这里就是合成动作。
格式:
blend <axis> <start> <end>
To set up a blending animation, include a second SMD file path after the first in your $sequence line. Then follow it with the blend tag, which allows you to specify the limits for the blend in the same manner as for a $controller. So a ** blend statement would look like this:
$sequence “blend” “up_pose” “down_pose” blend XR 45 -45
The two animation SMDs in a blend $sequence have to have the same number of frames.
建立一个合成动作,只要在$sequence第一个smd文件名后面加上第二个smd文件名,然后加上blend标签,它允许指定合成的**,如同$controller。所以一个简单的合成描述就象这样:
$sequence “blend” “up_pose” “down_pose” blend XR 45 -45
两个合成的smd动作必须拥有相同的帧数。
用ms3d反编译出来的QC,smd名称是没有大括号的,只是为了读起来方便。比如:
$sequence ref_shoot_ak47 "ref_shoot_ak47_blend1" "ref_shoot_ak47_blend2" "ref_shoot_ak47_blend3" "ref_shoot_ak47_blend4" "ref_shoot_ak47_blend5" "ref_shoot_ak47_blend6" "ref_shoot_ak47_blend7" "ref_shoot_ak47_blend8" "ref_shoot_ak47_blend9" fps 30 blend XR -90 90 { event 5001 0 "40" }
所以可以看出*blend1.smd-*blend9.smd就是合成的一系列动作。
QC中原本有个动作是so_am_I.smd而且这个动作就是原来没有动过的主模型姿势,有下面的代码:
$sequence "so_am_I" "so_am_I" fps 30
我改成了:
$sequence "so_am_I" "walk" "crouch_reload_m249" blend XR -90 90 fps 30
结果如下图。。。
根据图片,发现这种合成的模式类似character studio中的动作混合,两个动作都有表现,不是单纯的把第一个的上半身动作与第二个的下半身动作简单合并。
所以可以肯定游戏中常见的上半身是拿木仓动作,下半身是LX提取的动作这种情况并不是QC决定的,而是代码决定的,比如:
$sequence "ref_aim_onehanded" {
"swim"
fps 30 loop
}
ref_aim_onehanded被我改成了只有一个swim而且不使用blend结果如图。
上半身是游泳动作,下半身还是walk动作。
对LX提取的动作使用合成,在hlmv中有效果但在游戏中基本没有效果,可能代码对LX的动作不支持合成。
动作合成比较复杂,很多种写法在QC编译时就过不了了,而且具体为什么要动作合成也不是很明白。可能是为了在合成动作的变化中造成类似过渡的效果,而不是生硬的变化。
7.动作标记(ACT_*)
“Monster” models – i.e. any model controlled by an AI – use the action tag mechanism. Action tags are added to a $sequence line in the QC file to tell the AI that a particular animation sequence corresponds to a particular AI function – for example walking, shooting, or dying. The AI is only aware of animations marked with action tags. Note that the action tag is not the same as the sequence name – a sequence called “walk” that does not have an ACT_WALK tag will not be recognized as a walk animation by the AI.
The AI will automatically use the speed and duration of tagged animations in its decision-making process. Thus to change a monster’s movement speed, it is necessary only to change its ACT_WALK animation – you could even simply change the framerate of the animation in the QC file. The AI will navigate the character using the new speed without code changes.
It is possible for more than one sequence to have a particular action tag. A character with several different idling animations might have a number of animations with ACT_IDLE tags, for example. If there are multiple sequences with the same action tag, the AI will choose randomly between the eligible sequences. You can weight that choice by adding a number to the action tag; for example if you have two sequences:
$sequence “normal_walk” “normalwalk” fps 30 loop LX ACT_WALK 1
$sequence “silly_walk” “sillywalk” fps 30 loop LX ACT_WALK 2
the “silly walk” animation is twice as likely to be called as the “normal walk”. The probability of choosing the any particular animation is its action tag number divided by the sum of all the numbers for sequences with this tag.
照这么理解代码判别动作的意义根据的就是ACT_WALK这类动作标记。当有多个场景动作使用了相同的动作标记,AI会随机选择这些动作标记。而且还能对这些动作标记设置权重,比如:
$sequence “normal_walk” “normalwalk” fps 30 loop LX ACT_WALK 1
$sequence “silly_walk” “sillywalk” fps 30 loop LX ACT_WALK 2
那sillywalk被选到的几率就会是normalwalk的两倍。
经过测试证明在CS1.6中即使改写动作标签或者删除他们都是无效的,也就是说已经被编译进了代码,只有改变动作的顺序才能起作用。
动作标记的列表:
Action Tag Description
ACT_ARM Activate weapon (e.g. draw gun)
ACT_BARNACLE_CHEW Barnacle is holding the monster in its mouth ( loop )
ACT_BARNACLE_CHOMP Barnacle latches on to the monster
ACT_BARNACLE_HIT Barnacle tongue hits a monster
ACT_BARNACLE_PULL Barnacle is lifting the monster ( loop )
ACT_BIG_FLINCH Large reaction to non-specific hit
ACT_BITE This plays one time eat loops for large monsters which can eat small things in one bite
ACT_COMBAT_IDLE. Agitated idle, played when monster expects to fight
ACT_COWER Display a fear behavior
ACT_CROUCH The act of crouching down from a standing position
ACT_CROUCHIDLE Hold body in crouched position (loop)
ACT_DETECT_SCENT This means the monster smells a scent carried by the air
ACT_DIE_BACKSHOT Die hit in back
ACT_DIE_CHESTSHOT Die hit in chest
ACT_DIE_GUTSHOT Die hit in gut
ACT_DIE_HEADSHOT Die hit in head.
ACT_DIEBACKWARD Die falling backwards
ACT_DIEFORWARD Die falling forwards
ACT_DIE** Death animation
ACT_DIEVIOLENT Exaggerated death animation
ACT_DISARM Put away weapon (e.g. re-holster gun)
ACT_EAT Monster chewing on a large food item (loop)
ACT_EXCITED For some reason monster is excited. Sees something he really likes to eat or whatever.
ACT_FALL Looping animation for falling monster
ACT_FEAR_DISPLAY Monster just saw something that it is afraid of
ACT_FLINCH_CHEST Flinch from chest hit
ACT_FLINCH_HEAD Flinch from head hit
ACT_FLINCH_LEFTARM Flinch from left arm hit
ACT_FLINCH_LEFTLEG Flinch from left leg hit
ACT_FLINCH_RIGHTARM Flinch from right arm hit
ACT_FLINCH_RIGHTLEG Flinch from right leg hit
ACT_FLINCH_STOMACH Flinch from stomach hit
ACT_FLY Fly (and flap if appropriate) Fly (lx loop)
ACT_FLY_LEFT Turn left in flight
ACT_FLY_RIGHT Turn right in flight
ACT_GLIDE Fly without wing movement (lx loop)
ACT_GUARD Defend an area
ACT_HOP Vertical jump
ACT_HOVER Idle while in flight (loop)
ACT_IDLE Default behavior when nothing else is going on (loop)
ACT_IDLE_ANGRY Alternate idle animation in which the monster is clearly agitated. (loop)
ACT_INSPECT_FLOOR For active idles -- look at something on or near the floor
ACT_INSPECT_WALL For active idles -- look at something directly ahead of you
(doesn't have to be a wall or on a wall )
ACT_LAND End of a jump
ACT_LEAP Long forward jump
ACT_MELEE_ATTACK1 Attack at close range
ACT_MELEE_ATTACK2 Alternate close range attack
ACT_RANGE_ATTACK1 Attack with ranged weapon
ACT_RANGE_ATTACK2 Alternate ranged attack
ACT_RELOAD Reload weapon
ACT_ROLL_LEFT Tuck and roll left
ACT_ROLL_RIGHT Tuck and roll right
ACT_RUN Run (loop)
ACT_RUN_HURT Limp (loop)
ACT_RUN_SCARED Run displaying fear (loop)
ACT_SIGNAL1 Signal
ACT_SIGNAL2 Alternate signal
ACT_SIGNAL3 Alternate signal
ACT_SLEEP Sleep (loop)
ACT_SMALL_FLINCH Small reaction to non-specific hit
ACT_SNIFF This is the act of actually sniffing an item in front of the monster
ACT_SPECIAL_ATTACK1 Monster specific special attack
ACT_SPECIAL_ATTACK2 Monster specific special attack
ACT_STAND The act of standing from a crouched position
ACT_STRAFE_LEFT Sidestep left while maintaining facing (loop)
ACT_STRAFE_RIGHT Sidestep right while maintaining facing (loop)
ACT_SWIM Swim (loop)
ACT_THREAT_DISPLAY Without attacking monster demonstrates that it is angry
ACT_TURN_LEFT Turn in place quickly left
ACT_TURN_RIGHT Turn in place quickly right
ACT_TWITCH Twitch
ACT_USE Use item
ACT_VICTORY_DANCE. Victory display after killing player
ACT_WALK Walk (loop)
ACT_WALK_HURT Limp or wounded walk (loop)
ACT_WALK_SCARED Walk with fear display (loop)
8.event事件
事件列表:
Scripted Sequence events Extra parameters
1000 Character dead at this point
1001 Sequence un-interruptible from this point
1002 Sequence interruptible from this point
1003 Fires a trigger in the map Trigger name
1004 Play .wav file .Wav file path
1005 Play sentence file Sentence file path
1006 Do not send character back to floor at end of script
1007 Go to this animation after script completes Animation sequence name
1008 Play named .wav file through voice channel .Wav file path
1009 Play random sentence group (25 % chance)
1010 Character is alive at this point
Monster specific events
2001 Monster drops light body
2002 Monster drops heavy body
2010 Monster plays swing or swish sound
2020 Monster has turned 180
Clientside events for viewmodels
5001 Muzzleflash on attachment 0 Muzzle flash sprite path
5002 Spark on attachment
5004 Emit a sound Wav file path
5011 Muzzleflash on attachment 1 Muzzle flash sprite path
5021 Muzzleflash on attachment 2 Muzzle flash sprite path
5031 Muzzleflash on attachment 3 Muzzle flash sprite path
6001 Eject a brass shell from attachment
根据测试,CS的模型中对这些代码的更改应该都有效,而且5000以上的代码都能看出效果,但是2000以上就看不出效果。
格式:event <#> <frame>
比如:
$sequence "gutshot" "gutshot" fps 30 ACT_DIE_GUTSHOT 1 { event 2001 1 }
试不出event 2001 有什么效果,而且也不明白light body和heavy body的区别。。。
可能不是CS模型的范畴了。
以上就是我看了sdk后测试的一些结果,之所以把原版英文发出来,因为我觉得有些话翻译出来了未必就是原来的味道,而且我的英语水平。。。。。。所以建议英语好的朋友看英文解释。
另外本想删除头部的骨骼head,而且把QC中$hbox定义的head骨骼也删掉,看能否编译,结果发现过不了$bbox。
$cbox不明白是什么意思,知道的朋友不妨告诉我啊。
阿发说把骨骼删得只剩下一个也照样能进游戏。